Added FullPrice column to display Happy Hour Pricing.

Added Void or Reprint Report.
Changed Product.SalePrice -> Price
Changed Inventory.Rate -> Price
This commit is contained in:
unknown 2011-08-28 17:47:15 +05:30
parent 831ec37cda
commit 719dbd49d2
26 changed files with 850 additions and 1179 deletions

@ -9,6 +9,7 @@ namespace Tanshu.Accounts.Contracts
public int ProductID { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
public decimal FullPrice { get; set; }
public decimal Quantity { get; set; }
private decimal _discount;
public Product Product { get; private set; }
@ -104,7 +105,8 @@ namespace Tanshu.Accounts.Contracts
ProductID = product.ProductID;
Name = product.Units == string.Empty ? product.Name : product.Name + " (" + product.Units + ")";
Quantity = 1;
Price = product.SalePrice;
Price = product.Price;
FullPrice = product.FullPrice;
Tax = product.Tax.Rate;
ServiceCharge = product.ServiceCharge;
Discount = 0;
@ -118,6 +120,7 @@ namespace Tanshu.Accounts.Contracts
Discount = 0;
Name = "== New Kot ==";
Price = 0;
FullPrice = 0;
Printed = true;
Quantity = 0;
Tax = -1;
@ -131,6 +134,7 @@ namespace Tanshu.Accounts.Contracts
Discount = 0;
Name = string.Format("Kot: {0} / {1:dd-MMM HH:mm} ({2})", kot.Code, kot.Date, kot.User.Name);
Price = 0;
FullPrice = 0;
Printed = true;
Quantity = 0;
Tax = -1;

@ -1,13 +0,0 @@
using System;
using System.Runtime.Serialization;
using FluentNHibernate.Mapping;
using Tanshu.Accounts.Entities;
namespace Tanshu.Accounts.Contracts
{
public class ProductDisplay : Product
{
public virtual decimal Price { get; set; }
public virtual string Group { get; set; }
}
}

@ -21,7 +21,8 @@ namespace Tanshu.Accounts.Entities
public virtual Product Product { get; set; }
public virtual decimal Quantity { get; set; }
public virtual decimal Rate { get; set; }
public virtual decimal Price { get; set; }
public virtual decimal FullPrice { get; set; }
public virtual decimal Tax { get; set; }
public virtual decimal Discount { get; set; }
public virtual decimal ServiceCharge { get; set; }
@ -29,10 +30,10 @@ namespace Tanshu.Accounts.Entities
[Cascade]
public virtual IList<InventoryModifier> InventoryModifier { get; set; }
[Formula(Formula = "Quantity * Rate * (1 - Discount) * (1 + ServiceCharge) * (1 + Tax)")]
[Formula(Formula = "Quantity * Price * (1 - Discount) * (1 + ServiceCharge) * (1 + Tax)")]
public virtual decimal Amount
{
get { return Quantity * Rate * (1 + Tax) * (1 + ServiceCharge) * (1 - Discount); }
get { return Quantity * Price * (1 + Tax) * (1 + ServiceCharge) * (1 - Discount); }
private set { }
}
}

@ -14,7 +14,8 @@ namespace Tanshu.Accounts.Entities
[NotNull]
public virtual Tax Tax { get; set; }
public virtual decimal ServiceCharge { get; set; }
public virtual decimal SalePrice { get; set; }
public virtual decimal Price { get; set; }
public virtual decimal FullPrice { get; set; }
public virtual bool Discontinued { get; set; }
public virtual int SortOrder { get; set; }
}

@ -36,9 +36,12 @@ namespace Tanshu.Accounts.Contracts
public static RoleConstants PRINT_BILL = new RoleConstants("Sales/PrintBill");
public static RoleConstants PRINT_KOT = new RoleConstants("Sales/PrintKOT");
public static RoleConstants SALES = new RoleConstants("Sales/SalesBill");
public static RoleConstants VOID_OR_REPRINTED_BILL_REPORT = new RoleConstants("Void or Reprinted Bill Report");
public static RoleConstants BILL_DETAILS = new RoleConstants("Sales/BillDetails");
public static RoleConstants SALE_ANALYSIS = new RoleConstants("Sales/SaleAnalysis");
public static RoleConstants SALE_DETAIL = new RoleConstants("Sales/SaleDetail");
public static RoleConstants SPLIT_BILL = new RoleConstants("Split Bill");
public static RoleConstants VOID_BILL = new RoleConstants("Sales/VoidPrintedBill");
public static RoleConstants ZERO_RATE = new RoleConstants("Sales/ZeroRate");

@ -75,6 +75,10 @@
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Tanshu.Common, Version=2.0.4211.37426, Culture=neutral, PublicKeyToken=fd89fe1d2351f8b5, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Include\Tanshu.Common.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Attributes\CascadeAttribute.cs" />
@ -89,6 +93,9 @@
<Compile Include="Data Contracts Display\BillItemKey.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Data Contracts Display\ProductDisplaySmallBO.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Data Contracts\Auth\UserGroup.cs" />
<Compile Include="Data Contracts\Auth\RoleGroup.cs" />
<Compile Include="Data Contracts\Auth\Group.cs" />
@ -112,8 +119,6 @@
<Compile Include="Data Contracts\PaymentBO.cs" />
<Compile Include="Data Contracts Display\PendingBillsBO.cs" />
<Compile Include="Data Contracts\ProductBO.cs" />
<Compile Include="Data Contracts Display\ProductDisplayBO.cs" />
<Compile Include="Data Contracts Display\ProductDisplaySmallBO.cs" />
<Compile Include="Data Contracts\ProductGroupBO.cs" />
<Compile Include="Helper Functions\ReflectionHelper.cs" />
<Compile Include="Helper Functions\EnumHelper.cs" />

@ -60,7 +60,7 @@ namespace Tanshu.Accounts.Helpers
{
var item = list[i];
var control = GetButton(string.Format("p{0}", i), item.Units == string.Empty ? item.Name : string.Format("{0} ({1})", item.Name, item.Units), size.X, size.Y, item, bcDelegate);
if (item.SalePrice == 0)
if (item.Price == 0)
control.BackColor = Color.Yellow;
panel.Controls.Add(control);
}

@ -335,7 +335,7 @@ namespace Tanshu.Accounts.PointOfSale
inv.Product.Units == string.Empty
? inv.Product.Name
: inv.Product.Name + " (" + inv.Product.Units + ")",
Price = inv.Rate,
Price = inv.Price,
Printed = true,
Quantity = inv.Quantity,
Tax = inv.Tax,
@ -558,16 +558,18 @@ namespace Tanshu.Accounts.PointOfSale
return;
if (_bill.Count == 1) //new kot only
return;
if (_billInfo.Void) //voided bills not allowed
{
MessageBox.Show(string.Format("This Bill is already void.\nReason: {0}", _billInfo.VoidReason), "Bill already Voided", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
var printed = false;
if (_billInfo != null)
using (var bi = new VoucherBI(false))
printed = bi.IsVoucherPrinted(_billInfo.VoucherID);
{
var voucher = bi.Get(_billInfo.VoucherID);
if (voucher.Void)
{
MessageBox.Show(string.Format("This Bill is already void.\nReason: {0}", _billInfo.VoidReason), "Bill already Voided", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
printed = voucher.Printed;
}
if (printed && (!Session.IsAllowed(RoleConstants.EDIT_PRINTED_BILL)))
return;
var amount = _bill.Where(x => x.Key.BillItemType == BillItemType.Product && x.Key.KotID != 0).Sum(x => x.Value.GrossAmount);
@ -739,7 +741,7 @@ namespace Tanshu.Accounts.PointOfSale
{
var i = _billInfo.Kots.Single(x => x.KotID == item.Key.KotID).Inventories.Single(x => x.Product.ProductID == item.Key.ProductID);
i.Discount = item.Value.Discount;
i.Rate = item.Value.Price;
i.Price = item.Value.Price;
}
}
private static Kot GetKot(IEnumerable<KeyValuePair<BillItemKey, BillItemValue>> list)
@ -760,7 +762,8 @@ namespace Tanshu.Accounts.PointOfSale
{
Product = item.Value.Product,
Quantity = item.Value.Quantity,
Rate = item.Value.Price,
Price = item.Value.Price,
FullPrice = item.Value.FullPrice,
Discount = item.Value.Discount,
ServiceCharge = item.Value.ServiceCharge,
Tax = item.Value.Tax

@ -188,6 +188,7 @@ namespace Tanshu.Accounts.PointOfSale
btnSaleDetail.Visible = Session.IsAllowed(RoleConstants.SALE_DETAIL);
btnBillDetails.Visible = Session.IsAllowed(RoleConstants.BILL_DETAILS);
btnVoidOrReprints.Visible = Session.IsAllowed(RoleConstants.VOID_OR_REPRINTED_BILL_REPORT);
btnChangePassword.Visible = Session.IsAuthenticated;
}
@ -267,6 +268,13 @@ namespace Tanshu.Accounts.PointOfSale
frm.ShowDialog();
}
private void btnVoidOrReprints_Click(object sender, EventArgs e)
{
if (Session.IsAllowed(RoleConstants.VOID_OR_REPRINTED_BILL_REPORT))
using (var frm = new VoidReprintedForm())
frm.ShowDialog();
}
}
}

@ -48,6 +48,7 @@
this.btnBillDetails = new System.Windows.Forms.Button();
this.btnChangePassword = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.btnVoidOrReprints = new System.Windows.Forms.Button();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
@ -100,6 +101,7 @@
this.flowLayoutPanel1.Controls.Add(this.btnSaleAnalysis);
this.flowLayoutPanel1.Controls.Add(this.btnSaleDetail);
this.flowLayoutPanel1.Controls.Add(this.btnBillDetails);
this.flowLayoutPanel1.Controls.Add(this.btnVoidOrReprints);
this.flowLayoutPanel1.Controls.Add(this.btnChangePassword);
this.flowLayoutPanel1.Controls.Add(this.btnExit);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
@ -250,7 +252,7 @@
//
// btnChangePassword
//
this.btnChangePassword.Location = new System.Drawing.Point(315, 321);
this.btnChangePassword.Location = new System.Drawing.Point(471, 321);
this.btnChangePassword.Name = "btnChangePassword";
this.btnChangePassword.Size = new System.Drawing.Size(150, 100);
this.btnChangePassword.TabIndex = 17;
@ -260,7 +262,7 @@
//
// btnExit
//
this.btnExit.Location = new System.Drawing.Point(471, 321);
this.btnExit.Location = new System.Drawing.Point(627, 321);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(150, 100);
this.btnExit.TabIndex = 18;
@ -268,6 +270,16 @@
this.btnExit.UseVisualStyleBackColor = true;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// btnVoidOrReprints
//
this.btnVoidOrReprints.Location = new System.Drawing.Point(315, 321);
this.btnVoidOrReprints.Name = "btnVoidOrReprints";
this.btnVoidOrReprints.Size = new System.Drawing.Size(150, 100);
this.btnVoidOrReprints.TabIndex = 19;
this.btnVoidOrReprints.Text = "Voids or Reprints";
this.btnVoidOrReprints.UseVisualStyleBackColor = true;
this.btnVoidOrReprints.Click += new System.EventHandler(this.btnVoidOrReprints_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -306,5 +318,6 @@
private System.Windows.Forms.Button btnSwipeLogin;
private System.Windows.Forms.Button btnOpenBill;
private System.Windows.Forms.Button btnBillDetails;
private System.Windows.Forms.Button btnVoidOrReprints;
}
}

@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Tanshu.Accounts.Repository;
using Tanshu.Accounts.Contracts;
namespace Tanshu.Accounts.Management
{
public partial class QuantityForm : Form
{
IList<BillDetail> _list;
//private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public QuantityForm()
{
InitializeComponent();
//log.Warn(string.Format("Sales Analysis by: {0}", Session.User.Name));
}
private void dtpStart_ValueChanged(object sender, EventArgs e)
{
ShowStatement();
}
private void ShowStatement()
{
_list = new SalesAnalysisBI().GetBillDetails(dtpStart.Value, dtpFinish.Value);
dgvSale.AutoGenerateColumns = true;
dgvSale.DataSource = _list;
dgvSale.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
dgvSale.Columns[1].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
dgvSale.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
}
private void dtpFinish_ValueChanged(object sender, EventArgs e)
{
ShowStatement();
}
private void Sale_Analysis_Form_Load(object sender, EventArgs e)
{
dtpStart.Value = DateTime.Today;
dtpFinish.Value = DateTime.Today;
ShowStatement();
}
private void btnGo_Click(object sender, EventArgs e)
{
string type = null;
if (rbLight.Checked)
{
type = "Light";
}
else if (rbPremium.Checked)
{
type = "Premium";
}
else if (rbWheat.Checked)
{
type = "Wheat";
}
else if (rbDark.Checked)
{
type = "Dark";
}
else if (rbFestival.Checked)
{
type = "Festival";
}
MessageBox.Show(GetQuantity(type).ToString());
}
private decimal GetQuantity(string type)
{
""
}
}
}

@ -0,0 +1,198 @@
namespace Tanshu.Accounts.Management
{
partial class QuantityForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dtpFinish = new System.Windows.Forms.DateTimePicker();
this.dtpStart = new System.Windows.Forms.DateTimePicker();
this.label10 = new System.Windows.Forms.Label();
this.flpProducts = new System.Windows.Forms.FlowLayoutPanel();
this.rbLight = new System.Windows.Forms.RadioButton();
this.rbPremium = new System.Windows.Forms.RadioButton();
this.rbWheat = new System.Windows.Forms.RadioButton();
this.rbDark = new System.Windows.Forms.RadioButton();
this.rbFestival = new System.Windows.Forms.RadioButton();
this.txtQuantity = new System.Windows.Forms.TextBox();
this.btnGo = new System.Windows.Forms.Button();
this.flpProducts.SuspendLayout();
this.SuspendLayout();
//
// dtpFinish
//
this.dtpFinish.CustomFormat = "dd-MMM-yyyy";
this.dtpFinish.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtpFinish.Location = new System.Drawing.Point(168, 12);
this.dtpFinish.Name = "dtpFinish";
this.dtpFinish.Size = new System.Drawing.Size(90, 20);
this.dtpFinish.TabIndex = 21;
this.dtpFinish.ValueChanged += new System.EventHandler(this.dtpFinish_ValueChanged);
//
// dtpStart
//
this.dtpStart.CustomFormat = "dd-MMM-yyyy";
this.dtpStart.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtpStart.Location = new System.Drawing.Point(12, 12);
this.dtpStart.Name = "dtpStart";
this.dtpStart.Size = new System.Drawing.Size(90, 20);
this.dtpStart.TabIndex = 20;
this.dtpStart.ValueChanged += new System.EventHandler(this.dtpStart_ValueChanged);
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(108, 16);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(54, 13);
this.label10.TabIndex = 22;
this.label10.Text = "<- Date ->";
//
// flpProducts
//
this.flpProducts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.flpProducts.Controls.Add(this.rbLight);
this.flpProducts.Controls.Add(this.rbPremium);
this.flpProducts.Controls.Add(this.rbWheat);
this.flpProducts.Controls.Add(this.rbDark);
this.flpProducts.Controls.Add(this.rbFestival);
this.flpProducts.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flpProducts.Location = new System.Drawing.Point(12, 38);
this.flpProducts.Name = "flpProducts";
this.flpProducts.Size = new System.Drawing.Size(335, 137);
this.flpProducts.TabIndex = 23;
//
// rbLight
//
this.rbLight.AutoSize = true;
this.rbLight.Location = new System.Drawing.Point(3, 3);
this.rbLight.Name = "rbLight";
this.rbLight.Size = new System.Drawing.Size(48, 17);
this.rbLight.TabIndex = 0;
this.rbLight.TabStop = true;
this.rbLight.Text = "Light";
this.rbLight.UseVisualStyleBackColor = true;
//
// rbPremium
//
this.rbPremium.AutoSize = true;
this.rbPremium.Location = new System.Drawing.Point(3, 26);
this.rbPremium.Name = "rbPremium";
this.rbPremium.Size = new System.Drawing.Size(65, 17);
this.rbPremium.TabIndex = 1;
this.rbPremium.TabStop = true;
this.rbPremium.Text = "Premium";
this.rbPremium.UseVisualStyleBackColor = true;
//
// rbWheat
//
this.rbWheat.AutoSize = true;
this.rbWheat.Location = new System.Drawing.Point(3, 49);
this.rbWheat.Name = "rbWheat";
this.rbWheat.Size = new System.Drawing.Size(57, 17);
this.rbWheat.TabIndex = 2;
this.rbWheat.TabStop = true;
this.rbWheat.Text = "Wheat";
this.rbWheat.UseVisualStyleBackColor = true;
//
// rbDark
//
this.rbDark.AutoSize = true;
this.rbDark.Location = new System.Drawing.Point(3, 72);
this.rbDark.Name = "rbDark";
this.rbDark.Size = new System.Drawing.Size(48, 17);
this.rbDark.TabIndex = 3;
this.rbDark.TabStop = true;
this.rbDark.Text = "Dark";
this.rbDark.UseVisualStyleBackColor = true;
//
// rbFestival
//
this.rbFestival.AutoSize = true;
this.rbFestival.Location = new System.Drawing.Point(3, 95);
this.rbFestival.Name = "rbFestival";
this.rbFestival.Size = new System.Drawing.Size(61, 17);
this.rbFestival.TabIndex = 4;
this.rbFestival.TabStop = true;
this.rbFestival.Text = "Festival";
this.rbFestival.UseVisualStyleBackColor = true;
//
// txtQuantity
//
this.txtQuantity.Location = new System.Drawing.Point(12, 181);
this.txtQuantity.Name = "txtQuantity";
this.txtQuantity.Size = new System.Drawing.Size(335, 20);
this.txtQuantity.TabIndex = 5;
//
// btnGo
//
this.btnGo.Location = new System.Drawing.Point(12, 207);
this.btnGo.Name = "btnGo";
this.btnGo.Size = new System.Drawing.Size(335, 23);
this.btnGo.TabIndex = 24;
this.btnGo.Text = "Go";
this.btnGo.UseVisualStyleBackColor = true;
this.btnGo.Click += new System.EventHandler(this.btnGo_Click);
//
// QuantityForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(359, 242);
this.Controls.Add(this.btnGo);
this.Controls.Add(this.flpProducts);
this.Controls.Add(this.dtpFinish);
this.Controls.Add(this.dtpStart);
this.Controls.Add(this.label10);
this.Controls.Add(this.txtQuantity);
this.MaximizeBox = false;
this.Name = "QuantityForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Sale Analysis Form";
this.Load += new System.EventHandler(this.Sale_Analysis_Form_Load);
this.flpProducts.ResumeLayout(false);
this.flpProducts.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.DateTimePicker dtpFinish;
private System.Windows.Forms.DateTimePicker dtpStart;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.FlowLayoutPanel flpProducts;
private System.Windows.Forms.RadioButton rbLight;
private System.Windows.Forms.RadioButton rbPremium;
private System.Windows.Forms.RadioButton rbWheat;
private System.Windows.Forms.RadioButton rbDark;
private System.Windows.Forms.RadioButton rbFestival;
private System.Windows.Forms.TextBox txtQuantity;
private System.Windows.Forms.Button btnGo;
}
}

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -40,7 +40,7 @@
this.Label2 = new System.Windows.Forms.Label();
this.txtUnits = new System.Windows.Forms.TextBox();
this.txtName = new System.Windows.Forms.TextBox();
this.txtSalePrice = new System.Windows.Forms.TextBox();
this.txtPrice = new System.Windows.Forms.TextBox();
this.cmbTax = new System.Windows.Forms.ComboBox();
this.chkDiscontinued = new System.Windows.Forms.CheckBox();
this.txtServiceCharge = new System.Windows.Forms.TextBox();
@ -140,14 +140,14 @@
this.txtName.Size = new System.Drawing.Size(189, 20);
this.txtName.TabIndex = 1;
//
// txtSalePrice
// txtPrice
//
this.txtSalePrice.AccessibleName = "";
this.txtSalePrice.Location = new System.Drawing.Point(112, 64);
this.txtSalePrice.Name = "txtSalePrice";
this.txtSalePrice.Size = new System.Drawing.Size(189, 20);
this.txtSalePrice.TabIndex = 3;
this.txtSalePrice.Text = "0";
this.txtPrice.AccessibleName = "";
this.txtPrice.Location = new System.Drawing.Point(112, 64);
this.txtPrice.Name = "txtPrice";
this.txtPrice.Size = new System.Drawing.Size(189, 20);
this.txtPrice.TabIndex = 3;
this.txtPrice.Text = "0";
//
// cmbTax
//
@ -252,7 +252,7 @@
this.Controls.Add(this.chkDiscontinued);
this.Controls.Add(this.txtServiceCharge);
this.Controls.Add(this.Label7);
this.Controls.Add(this.txtSalePrice);
this.Controls.Add(this.txtPrice);
this.Controls.Add(this.label5);
this.Controls.Add(this.cmbTax);
this.Controls.Add(this.txtUnits);
@ -288,7 +288,7 @@
internal System.Windows.Forms.Label Label2;
internal System.Windows.Forms.TextBox txtUnits;
internal System.Windows.Forms.TextBox txtName;
internal System.Windows.Forms.TextBox txtSalePrice;
internal System.Windows.Forms.TextBox txtPrice;
internal System.Windows.Forms.ComboBox cmbTax;
private System.Windows.Forms.CheckBox chkDiscontinued;
internal System.Windows.Forms.TextBox txtServiceCharge;

@ -26,7 +26,7 @@ namespace Tanshu.Accounts.PointOfSale
txtCode.Text = product.Code.ToString();
txtName.Text = product.Name;
txtUnits.Text = product.Units;
txtSalePrice.Text = product.SalePrice.ToString("#.##");
txtPrice.Text = product.Price.ToString("#.##");
cmbTax.SelectedValue = product.Tax.TaxID;
txtServiceCharge.Text = product.ServiceCharge.ToString("#.##");
chkDiscontinued.Checked = product.Discontinued;
@ -78,11 +78,11 @@ namespace Tanshu.Accounts.PointOfSale
product.Units = txtUnits.Text.Trim();
decimal salePrice;
if (!decimal.TryParse(txtSalePrice.Text, out salePrice))
if (!decimal.TryParse(txtPrice.Text, out salePrice))
return null;
if (salePrice < 0)
return null;
product.SalePrice = salePrice;
product.Price = salePrice;
// Tax
if (cmbTax.SelectedItem == null)

@ -161,10 +161,10 @@
//
// salePriceDataGridViewTextBoxColumn
//
this.salePriceDataGridViewTextBoxColumn.DataPropertyName = "SalePrice";
this.salePriceDataGridViewTextBoxColumn.DataPropertyName = "Price";
dataGridViewCellStyle2.Format = "N0";
this.salePriceDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2;
this.salePriceDataGridViewTextBoxColumn.HeaderText = "SalePrice";
this.salePriceDataGridViewTextBoxColumn.HeaderText = "Price";
this.salePriceDataGridViewTextBoxColumn.Name = "salePriceDataGridViewTextBoxColumn";
this.salePriceDataGridViewTextBoxColumn.ReadOnly = true;
this.salePriceDataGridViewTextBoxColumn.Width = 77;

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Tanshu.Accounts.Repository;
using Tanshu.Accounts.Contracts;
using Tanshu.Accounts.Helpers;
namespace Tanshu.Accounts.PointOfSale
{
public partial class VoidReprintedForm : Form
{
IList<BillDetail> _list;
public VoidReprintedForm()
{
InitializeComponent();
}
private void dtpStart_ValueChanged(object sender, EventArgs e)
{
ShowStatement();
}
private void ShowStatement()
{
_list = new SalesAnalysisBI().VoidOrReprintedBillsList(dtpStart.Value, dtpFinish.Value);
dgvSale.AutoGenerateColumns = true;
dgvSale.DataSource = _list;
dgvSale.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
dgvSale.Columns[1].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
dgvSale.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
}
private void dtpFinish_ValueChanged(object sender, EventArgs e)
{
ShowStatement();
}
private void Sale_Analysis_Form_Load(object sender, EventArgs e)
{
dtpStart.Value = DateTime.Today;
dtpFinish.Value = DateTime.Today;
ShowStatement();
}
}
}

@ -0,0 +1,114 @@
namespace Tanshu.Accounts.PointOfSale
{
partial class VoidReprintedForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dgvSale = new System.Windows.Forms.DataGridView();
this.dtpFinish = new System.Windows.Forms.DateTimePicker();
this.dtpStart = new System.Windows.Forms.DateTimePicker();
this.label10 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dgvSale)).BeginInit();
this.SuspendLayout();
//
// dgvSale
//
this.dgvSale.AllowUserToAddRows = false;
this.dgvSale.AllowUserToDeleteRows = false;
this.dgvSale.AllowUserToResizeRows = false;
this.dgvSale.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgvSale.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvSale.Location = new System.Drawing.Point(12, 41);
this.dgvSale.MultiSelect = false;
this.dgvSale.Name = "dgvSale";
this.dgvSale.ReadOnly = true;
this.dgvSale.RowHeadersVisible = false;
this.dgvSale.RowTemplate.Height = 19;
this.dgvSale.RowTemplate.ReadOnly = true;
this.dgvSale.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvSale.Size = new System.Drawing.Size(335, 466);
this.dgvSale.TabIndex = 14;
//
// dtpFinish
//
this.dtpFinish.CustomFormat = "dd-MMM-yyyy";
this.dtpFinish.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtpFinish.Location = new System.Drawing.Point(168, 12);
this.dtpFinish.Name = "dtpFinish";
this.dtpFinish.Size = new System.Drawing.Size(90, 20);
this.dtpFinish.TabIndex = 21;
this.dtpFinish.ValueChanged += new System.EventHandler(this.dtpFinish_ValueChanged);
//
// dtpStart
//
this.dtpStart.CustomFormat = "dd-MMM-yyyy";
this.dtpStart.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtpStart.Location = new System.Drawing.Point(12, 12);
this.dtpStart.Name = "dtpStart";
this.dtpStart.Size = new System.Drawing.Size(90, 20);
this.dtpStart.TabIndex = 20;
this.dtpStart.ValueChanged += new System.EventHandler(this.dtpStart_ValueChanged);
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(108, 16);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(54, 13);
this.label10.TabIndex = 22;
this.label10.Text = "<- Date ->";
//
// BillDetailsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(359, 519);
this.Controls.Add(this.dgvSale);
this.Controls.Add(this.dtpFinish);
this.Controls.Add(this.dtpStart);
this.Controls.Add(this.label10);
this.MaximizeBox = false;
this.Name = "BillDetailsForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Sale Analysis Form";
this.Load += new System.EventHandler(this.Sale_Analysis_Form_Load);
((System.ComponentModel.ISupportInitialize)(this.dgvSale)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.DataGridView dgvSale;
private System.Windows.Forms.DateTimePicker dtpFinish;
private System.Windows.Forms.DateTimePicker dtpStart;
private System.Windows.Forms.Label label10;
}
}

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -149,6 +149,12 @@
<Compile Include="Reports\BillDetailsForm.designer.cs">
<DependentUpon>BillDetailsForm.cs</DependentUpon>
</Compile>
<Compile Include="Reports\VoidReprintedForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Reports\VoidReprintedForm.designer.cs">
<DependentUpon>VoidReprintedForm.cs</DependentUpon>
</Compile>
<Compile Include="Reports\SaleDetail.cs">
<SubType>Form</SubType>
</Compile>
@ -278,6 +284,10 @@
<DependentUpon>BillDetailsForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Reports\VoidReprintedForm.resx">
<DependentUpon>VoidReprintedForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Reports\SaleDetail.resx">
<DependentUpon>SaleDetail.cs</DependentUpon>
<SubType>Designer</SubType>
@ -417,6 +427,9 @@
<Name>Tanshu.Accounts.Repository</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Management\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

@ -49,10 +49,10 @@ namespace Tanshu.Accounts.Print
return billText;
}
private static string DesignBill(Voucher trans)
private static string DesignBill(Voucher voucher)
{
var list = new Dictionary<int, Inventory>();
foreach (var kot in trans.Kots)
foreach (var kot in voucher.Kots)
{
foreach (var item in kot.Inventories)
{
@ -62,10 +62,10 @@ namespace Tanshu.Accounts.Print
list.Add(item.Product.ProductID, item);
}
}
var cashier = trans.User;
var waiter = trans.Waiter;
var customer = trans.Customer;
var billNo = trans.BillID.Substring(trans.BillID.IndexOf("-") + 1);
var cashier = voucher.User;
var waiter = voucher.Waiter;
var customer = voucher.Customer;
var billNo = voucher.BillID.Substring(voucher.BillID.IndexOf("-") + 1);
var billText = "";
billText = "\n\r" + FormatText("Hops n Grains", 42, false, Align.Centre);
billText += "\n\r" + FormatText("The Microbrewery", 42, false, Align.Centre);
@ -75,8 +75,8 @@ namespace Tanshu.Accounts.Print
billText += "\n\r" + FormatText("Retail Invoice", 42, false, Align.Centre);
billText += "\n\r";
billText += "\n\r" + "Bill No: " + FormatText(billNo, 13, false, Align.Centre) +
string.Format("{0:dd-MMM-yyyy HH:mm:ss}", trans.Date);
billText += "\n\r" + "Table No.: " + trans.TableID;
string.Format("{0:dd-MMM-yyyy HH:mm:ss}", voucher.Date);
billText += "\n\r" + "Table No.: " + voucher.TableID;
billText += "\n\r" + "------------------------------------------";
billText += "\n\r" + "Qty. Particulars Price Amount";
billText += "\n\r" + "------------------------------------------";
@ -84,20 +84,10 @@ namespace Tanshu.Accounts.Print
{
if (item.Quantity == 0)
continue;
if (Math.Round((item.Rate * (1 + item.Tax)), 0) == 1)
{
billText += "\n\r" + " ";
billText += FormatText(Name(item.Product), 22, false, Align.Left) + " ";
billText += " ";
billText += FormatBillNum(item.Rate * item.Quantity, 6);
}
else
{
billText += "\n\r" + FormatBillNum(item.Quantity, 5) + " ";
billText += FormatText(Name(item.Product), 22, false, Align.Left) + " ";
billText += FormatBillNum(item.Rate, 6) + " ";
billText += FormatBillNum(item.Rate * item.Quantity, 6);
}
billText += "\n\r" + FormatBillNum(item.Quantity, 5) + " ";
billText += FormatText(Name(item.Product), 22, false, Align.Left) + " ";
billText += FormatBillNum(item.FullPrice, 6) + " ";
billText += FormatBillNum(item.FullPrice * item.Quantity, 6);
}
billText += "\n\r" + "------------------------------------------";
decimal amount;
@ -105,6 +95,10 @@ namespace Tanshu.Accounts.Print
if (amount != 0)
billText += "\n\r" + FormatText("Net : ", 33, false, Align.Right) + FormatBillNum(amount, 9);
amount = HappyHourDiscount(list.Values);
if (amount != 0)
billText += "\n\r" + FormatText("Happy Hour Discount : ", 33, false, Align.Right) + FormatBillNum(amount, 9);
amount = Discount(list.Values);
if (amount != 0)
billText += "\n\r" + FormatText("Discount : ", 33, false, Align.Right) + FormatBillNum(amount, 9);
@ -116,14 +110,14 @@ namespace Tanshu.Accounts.Print
// Begin Service Tax and VAT Hack
decimal st = 0;
amount = list.Values.Where(x => x.Tax == 0.14741M).Sum(item => item.Quantity * item.Rate * (1 - item.Discount) * (1 + item.ServiceCharge) * item.Tax);
amount = list.Values.Where(x => x.Tax == 0.14741M).Sum(item => item.Quantity * item.Price * (1 - item.Discount) * (1 + item.ServiceCharge) * item.Tax);
st = amount * 0.190564292M;
amount = amount * (1 - 0.190564292M);
if (amount != 0)
billText += "\n\r" + FormatText("VAT @ 12.5% + 5% Sur. : ", 33, false, Align.Right) +
FormatBillNum(amount, 9);
amount = list.Values.Where(x => x.Tax == 0.26673M).Sum(item => item.Quantity * item.Rate * (1 - item.Discount) * (1 + item.ServiceCharge) * item.Tax);
amount = list.Values.Where(x => x.Tax == 0.26673M).Sum(item => item.Quantity * item.Price * (1 - item.Discount) * (1 + item.ServiceCharge) * item.Tax);
st += amount * 0.105316973M;
amount = amount * (1 - 0.105316973M);
if (amount != 0)
@ -148,9 +142,9 @@ namespace Tanshu.Accounts.Print
Math.Round(amount, 0));
billText += DrawLine;
if (trans.Narration != "")
if (voucher.Narration != "")
{
billText += "\n\r" + FormatText(trans.Narration, 42, false, Align.Centre);
billText += "\n\r" + FormatText(voucher.Narration, 42, false, Align.Centre);
billText += DrawLine;
}
if (customer.CustomerID != 1)
@ -166,27 +160,32 @@ namespace Tanshu.Accounts.Print
private static decimal Amount(IEnumerable<Inventory> list)
{
return list.Sum(item => item.Quantity * item.Rate * (1 - item.Discount) * (1 + item.ServiceCharge) * (1 + item.Tax));
return list.Sum(item => item.Quantity * item.Price * (1 - item.Discount) * (1 + item.ServiceCharge) * (1 + item.Tax));
}
private static decimal Tax(IEnumerable<Inventory> list)
{
return list.Sum(item => item.Quantity * item.Rate * (1 - item.Discount) * (1 + item.ServiceCharge) * item.Tax);
return list.Sum(item => item.Quantity * item.Price * (1 - item.Discount) * (1 + item.ServiceCharge) * item.Tax);
}
private static decimal ServiceCharge(IEnumerable<Inventory> list)
{
return list.Sum(item => item.Quantity * item.Rate * (1 - item.Discount) * item.ServiceCharge);
return list.Sum(item => item.Quantity * item.Price * (1 - item.Discount) * item.ServiceCharge);
}
private static decimal Discount(IEnumerable<Inventory> list)
{
return list.Sum(item => item.Quantity * item.Rate * item.Discount);
return list.Sum(item => item.Quantity * item.Price * item.Discount);
}
private static decimal Net(IEnumerable<Inventory> list)
{
return list.Sum(item => item.Quantity * item.Rate);
return list.Sum(item => item.Quantity * item.FullPrice);
}
private static decimal HappyHourDiscount(IEnumerable<Inventory> list)
{
return list.Sum(item => item.Quantity * (item.FullPrice - item.Price));
}
private static string Name(Product product)

@ -314,7 +314,7 @@ and i.Discount >= :discount";
foreach (var item in list)
{
var amt = item.Settlements.Where(x => x.Settled == SettleOption.Amount).Sum(x => x.Amount) * -1;
var disc = item.Kots.Sum(x => x.Inventories.Sum(y => y.Quantity * y.Rate * y.Discount));
var disc = item.Kots.Sum(x => x.Inventories.Sum(y => y.Quantity * y.Price * y.Discount));
info += string.Format("\n\r{0:dd-MMM-yyyy HH:mm:ss} {1} {2}", item.Date, item.BillID, item.Customer.Name);
info += string.Format("\n\rAmount: {0:#0.00} :: Discount: {1:#0.00}", amt, disc);
info += "\n\r------------------------------------------";
@ -335,7 +335,7 @@ and i.Discount >= :discount";
foreach (var item in list)
{
var amt = item.Settlements.Where(x => x.Settled == settleOption).Sum(x => x.Amount);
var disc = item.Kots.Sum(x => x.Inventories.Sum(y => y.Quantity * y.Rate * y.Discount));
var disc = item.Kots.Sum(x => x.Inventories.Sum(y => y.Quantity * y.Price * y.Discount));
info += string.Format("\n\r{0:dd-MMM-yyyy HH:mm:ss} {1} {2}", item.Date, item.BillID, item.Customer.Name);
info += string.Format("\n\rAmount: {0:#0.00} :: Discount: {1:#0.00}", amt, disc);
info += "\n\r------------------------------------------";

@ -4,6 +4,7 @@ using Tanshu.Accounts.Contracts;
using Tanshu.Accounts.Entities;
using Tanshu.Common;
using Tanshu.Common.Helpers;
using System.Linq;
namespace Tanshu.Accounts.Repository
{
@ -79,7 +80,7 @@ order by p.ProductGroup, concat(p.Name, ' ', p.Units)
using (var session = SessionManager.Session)
{
const string query = @"
select g.GroupType as GroupType, Sum(i.Quantity * i.Rate * (1 - i.Discount)) as Amount
select g.GroupType as GroupType, Sum(i.Quantity * i.Price * (1 - i.Discount)) as Amount
from Voucher v
inner join v.Kots k
inner join k.Inventories i
@ -148,6 +149,56 @@ order by v.BillID, s.Settled
return outList;
}
}
public IList<BillDetail> VoidOrReprintedBillsList(DateTime startDate, DateTime finishDate)
{
startDate = startDate.Date.AddHours(6);
finishDate = finishDate.Date.AddDays(1).AddHours(5);
if (finishDate <= startDate)
return new List<BillDetail>();
using (var session = SessionManager.Session)
{
const string query = @"
select v.Date, v.BillID, s.Amount, v.VoidReason
from Voucher v
inner join v.Settlements s
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = true and s.Settled = :settled
order by v.BillID, s.Settled
";
var listVoids = session
.CreateQuery(query)
.SetParameter("startDate", startDate)
.SetParameter("finishDate", finishDate)
.SetParameter("settled", SettleOption.Amount)
.List<object[]>();
var outList = new List<BillDetail>();
foreach (var item in listVoids)
{
outList.Add(new BillDetail()
{
Date = (DateTime)item[0],
BillID = (string)item[1],
Settlement = string.Format("Void: {0}", (string)item[3]),
Amount = (decimal)item[2] * -1
});
}
var listReprint = session.QueryOver<Reprint>()
.Where(x => x.Date >= startDate && x.Date <= finishDate)
.List();
foreach (var item in listReprint)
{
outList.Add(new BillDetail()
{
Date = item.Date,
BillID = item.Voucher.BillID,
Settlement = string.Format("Reprinted by {0}", item.User.Name),
Amount = item.Voucher.Settlements.Single(x => x.Settled == SettleOption.Amount).Amount * -1
});
}
return outList;
}
}
private static IList<SalesAnalysis> GetSettlement(IList<SalesAnalysis> outList, DateTime startDate, DateTime finishDate)
{
outList.Add(new SalesAnalysis() { GroupType = " -- ", Amount = 0 });
@ -155,7 +206,7 @@ order by v.BillID, s.Settled
return new List<SalesAnalysis>();
using (var session = SessionManager.Session)
{
//select v.Settled, Sum(i.Quantity * i.Rate * (1 - i.Discount) * (1 + i.ServiceCharge) * (1 + i.Tax)) as Amount
//select v.Settled, Sum(i.Quantity * i.Price * (1 - i.Discount) * (1 + i.ServiceCharge) * (1 + i.Tax)) as Amount
const string query = @"
select s.Settled, Sum(s.Amount)
from Voucher v
@ -188,7 +239,7 @@ order by s.Settled
{
#region Service Charge
var query = @"
select Sum(i.Quantity * i.Rate * (1 - i.Discount) * i.ServiceCharge)
select Sum(i.Quantity * i.Price * (1 - i.Discount) * i.ServiceCharge)
from Voucher v
inner join v.Kots k
inner join k.Inventories i
@ -209,7 +260,7 @@ and vs.Settled != :noCharge and vs.Settled != :unsettled and vs.Settled != :amou
#endregion
#region Tax
query = @"
select i.Tax, Sum(i.Quantity * i.Rate * (1 - i.Discount) * (1 + i.ServiceCharge) * i.Tax)
select i.Tax, Sum(i.Quantity * i.Price * (1 - i.Discount) * (1 + i.ServiceCharge) * i.Tax)
from Voucher v
inner join v.Kots k
inner join k.Inventories i

@ -25,6 +25,10 @@ namespace Tanshu.Accounts.Repository
{
return Session.Get<Voucher>(voucherID).Printed;
}
public bool IsVoucherVoid(int voucherID)
{
return Session.Get<Voucher>(voucherID).Void;
}
public int? Insert(Voucher voucher)
{
var dt = DbValues.Date;

File diff suppressed because it is too large Load Diff

@ -104,7 +104,6 @@
<Compile Include="Fluent\AllowNullConvention.cs" />
<Compile Include="Fluent\EnumConvention.cs" />
<Compile Include="Fluent\QueryStore.cs" />
<Compile Include="Fluent\Fixtures.cs" />
<Compile Include="Fluent\StoreConfiguration.cs" />
<Compile Include="BusinessLayer\AdvanceBI.cs" />
<Compile Include="BusinessLayer\CustomerBI.cs" />