Refactor: Instead of a concept of Price/FullPrice, happy hour is now a checkbox in the product.
This needed major refactor in all parts dealing with product or inventory.
This commit is contained in:
@ -27,7 +27,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
public void AddProduct(Product product)
|
||||
{
|
||||
var newKey = new BillItemKey(product.ProductID, Guid.Empty);
|
||||
var newKey = new BillItemKey(product.ProductID, Guid.Empty, product.HasHappyHour);
|
||||
|
||||
if (_bill.ContainsKey(newKey))
|
||||
{
|
||||
@ -35,8 +35,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
else
|
||||
{
|
||||
var billItemValue = new BillItemValue(product);
|
||||
var old = _bill.FirstOrDefault(x => x.Key.BillItemType == BillItemType.Product && x.Key.ProductID == newKey.ProductID);
|
||||
var billItemValue = new BillItemValue(product, product.HasHappyHour);
|
||||
var old = _bill.FirstOrDefault(x => x.Key.BillItemType == (product.HasHappyHour ? BillItemType.HappyHourProduct : BillItemType.RegularProduct) && x.Key.ProductID == newKey.ProductID);
|
||||
if (old.Key != null)
|
||||
{
|
||||
billItemValue.inventory.Discount = old.Value.inventory.Discount;
|
||||
@ -70,7 +70,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (discount > 1 || discount < 0)
|
||||
return;
|
||||
|
||||
foreach (var item in _bill.Where(x => x.Key.BillItemType == BillItemType.Product && outList.Contains(x.Value.inventory.Product.ProductGroup.GroupType)))
|
||||
foreach (var item in _bill.Where(x => x.Key.BillItemType != BillItemType.Kot && outList.Contains(x.Value.inventory.Product.ProductGroup.GroupType)))
|
||||
{
|
||||
var product = item.Value.inventory.Product;
|
||||
var maxDiscount = product.ProductGroup.DiscountLimit;
|
||||
@ -99,6 +99,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
public void SetPrice(BillItemValue item)
|
||||
{
|
||||
if (item.inventory.IsHappyHour)
|
||||
return;
|
||||
if (!Session.IsAllowed("Change Rate"))
|
||||
return;
|
||||
var price = item.inventory.Price;
|
||||
@ -106,7 +108,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
return;
|
||||
if (price == 0 && !Session.IsAllowed("NC Product"))
|
||||
throw new PermissionException("NC of Product is not Allowed");
|
||||
foreach (var sub in _bill.Where(x => x.Key.BillItemType == BillItemType.Product && x.Key.ProductID == item.inventory.Product.ProductID))
|
||||
foreach (var sub in _bill.Where(x => x.Key.BillItemType != BillItemType.Kot && x.Key.ProductID == item.inventory.Product.ProductID))
|
||||
sub.Value.inventory.Price = price;
|
||||
}
|
||||
public void ShowCustomers()
|
||||
@ -138,7 +140,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
private void LoadBill(Guid voucherID)
|
||||
{
|
||||
ClearBill();
|
||||
using (var bi = new VoucherBI())
|
||||
{
|
||||
_voucher = bi.Get(x => x.VoucherID == voucherID);
|
||||
@ -345,7 +346,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
public bool SaveAndPrintKot()
|
||||
{
|
||||
#region Check if Allowed
|
||||
if (!Session.IsAllowed("Print Kot") || _bill.Count(x => x.Key.BillItemType == BillItemType.Product) == 0)
|
||||
if (!Session.IsAllowed("Print Kot") || _bill.Count(x => x.Key.BillItemType != BillItemType.Kot) == 0)
|
||||
return false;
|
||||
bool isPrinted = false, isVoid = false;
|
||||
if (_voucher.VoucherID != Guid.Empty)
|
||||
@ -383,7 +384,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
public bool SaveAndPrintBill()
|
||||
{
|
||||
#region Check if Allowed
|
||||
if (!Session.IsAllowed("Print Bill") || _bill.Count(x => x.Key.BillItemType == BillItemType.Product) == 0)
|
||||
if (!Session.IsAllowed("Print Bill") || _bill.Count(x => x.Key.BillItemType != BillItemType.Kot) == 0)
|
||||
return false;
|
||||
bool isPrinted = false, isVoid = false;
|
||||
if (_voucher.VoucherID != Guid.Empty)
|
||||
@ -464,8 +465,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (splitList == null || splitList.Count == 0)
|
||||
return;
|
||||
|
||||
var listFirst = _bill.Where(x => x.Key.BillItemType == BillItemType.Product && x.Key.KotID != Guid.Empty && splitList.Contains(x.Value.inventory.Product.ProductGroup.GroupType));
|
||||
var listSecond = _bill.Where(x => x.Key.BillItemType == BillItemType.Product && x.Key.KotID != Guid.Empty && !splitList.Contains(x.Value.inventory.Product.ProductGroup.GroupType));
|
||||
var listFirst = _bill.Where(x => x.Key.BillItemType != BillItemType.Kot && x.Key.KotID != Guid.Empty && splitList.Contains(x.Value.inventory.Product.ProductGroup.GroupType));
|
||||
var listSecond = _bill.Where(x => x.Key.BillItemType != BillItemType.Kot && x.Key.KotID != Guid.Empty && !splitList.Contains(x.Value.inventory.Product.ProductGroup.GroupType));
|
||||
|
||||
if (listFirst.Count() == 0 || listSecond.Count() == 0)
|
||||
return; // all or none items selected to be moved
|
||||
@ -527,43 +528,41 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (MessageBox.Show("Are you sure you want to void this bill?", "Void Bill", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
|
||||
return false;
|
||||
#endregion
|
||||
var reasons = new string[] {
|
||||
"Discount",
|
||||
"Printing Fault",
|
||||
"Item Changed",
|
||||
"Quantity Reduced",
|
||||
"Costing Bill for Party",
|
||||
"Cashier Mistake",
|
||||
"Management Freesale",
|
||||
"Other"
|
||||
};
|
||||
|
||||
var voidReason = new SelectVoidReason(GetVoidReason, true);
|
||||
voidReason.ShowDialog();
|
||||
if (voidReason.SelectedItem != null)
|
||||
|
||||
using (var voidReason = new VoidReasonListForm(reasons))
|
||||
{
|
||||
MessageBox.Show("Please Select a reason if you want to void the bill", "Bill NOT Voided", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
||||
return false;
|
||||
}
|
||||
using (var bi = new VoucherBI())
|
||||
{
|
||||
bi.VoidBill(_voucher.VoucherID, voidReason.SelectedItem.Description);
|
||||
if (!_editVoucherID.HasValue)
|
||||
bi.UpdateTable(x => x.FoodTableID == _voucher.Table.FoodTableID && x.VoucherID == _voucher.VoucherID, null, null);
|
||||
bi.SaveChanges();
|
||||
voidReason.ShowDialog();
|
||||
if (voidReason.SelectedItem == null)
|
||||
{
|
||||
MessageBox.Show("Please Select a reason if you want to void the bill", "Bill NOT Voided", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
||||
return false;
|
||||
}
|
||||
using (var bi = new VoucherBI())
|
||||
{
|
||||
bi.VoidBill(_voucher.VoucherID, voidReason.SelectedItem);
|
||||
if (!_editVoucherID.HasValue)
|
||||
bi.UpdateTable(x => x.FoodTableID == _voucher.Table.FoodTableID && x.VoucherID == _voucher.VoucherID, null, null);
|
||||
bi.SaveChanges();
|
||||
}
|
||||
}
|
||||
ClearBill();
|
||||
return true;
|
||||
}
|
||||
private static List<StringType> GetVoidReason(Dictionary<string, string> filter)
|
||||
{
|
||||
var list = new List<StringType>
|
||||
{
|
||||
new StringType("Discount"),
|
||||
new StringType("Printing Fault"),
|
||||
new StringType("Item Changed"),
|
||||
new StringType("Quantity Reduced"),
|
||||
new StringType("Costing Bill for Party"),
|
||||
new StringType("Cashier Mistake"),
|
||||
new StringType("Management Freesale"),
|
||||
new StringType("Other")
|
||||
};
|
||||
return list.Where(i => i.Description.ToLower().Contains(filter["Name"].ToLower().Trim())).ToList();
|
||||
}
|
||||
private void SaveReprintOrDiscountBill(decimal oldAmount)
|
||||
{
|
||||
var amountChanged = oldAmount != _bill.Where(x => x.Key.BillItemType == BillItemType.Product && x.Key.KotID != Guid.Empty).Sum(x => x.Value.inventory.Net);
|
||||
var itemsChanged = _bill.Where(x => x.Key.BillItemType == BillItemType.Product && x.Key.KotID == Guid.Empty).Count() != 0;
|
||||
var amountChanged = oldAmount != _bill.Where(x => x.Key.BillItemType != BillItemType.Kot && x.Key.KotID != Guid.Empty).Sum(x => x.Value.inventory.Net);
|
||||
var itemsChanged = _bill.Where(x => x.Key.BillItemType != BillItemType.Kot && x.Key.KotID == Guid.Empty).Count() != 0;
|
||||
|
||||
if (amountChanged || itemsChanged) // Discount or Products changed
|
||||
{
|
||||
@ -577,7 +576,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
VoucherType = _voucher.VoucherType
|
||||
};
|
||||
|
||||
var kotNew = GetKot(_bill.Where(x => x.Key.BillItemType == BillItemType.Product));
|
||||
var kotNew = GetKot(_bill.Where(x => x.Key.BillItemType != BillItemType.Kot));
|
||||
if (kotNew != null)
|
||||
newVoucher.Kots.Add(kotNew);
|
||||
#endregion
|
||||
@ -605,7 +604,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
_voucher.Printed = finalBill;
|
||||
_voucher.Void = false;
|
||||
_voucher.Narration = "";
|
||||
var kot = GetKot(_bill.Where(x => x.Key.BillItemType == BillItemType.Product && x.Key.KotID == Guid.Empty && x.Value.inventory.Quantity != 0));
|
||||
var kot = GetKot(_bill.Where(x => x.Key.KotID == Guid.Empty));
|
||||
if (kot == null)
|
||||
return null;
|
||||
_voucher.Kots.Add(kot);
|
||||
@ -630,15 +629,15 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
voucher.Customer = _voucher.Customer;
|
||||
voucher.Printed = finalBill;
|
||||
voucher.VoucherType = _voucher.VoucherType;
|
||||
foreach (var item in _bill.Where(x => x.Key.BillItemType == BillItemType.Product && x.Key.KotID != Guid.Empty))
|
||||
foreach (var item in _bill.Where(x => x.Key.BillItemType != BillItemType.Kot && x.Key.KotID != Guid.Empty))
|
||||
{
|
||||
var i = voucher.Kots.Single(x => x.KotID == item.Key.KotID).Inventories.Single(x => x.Product.ProductID == item.Key.ProductID);
|
||||
var i = voucher.Kots.Single(x => x.KotID == item.Key.KotID).Inventories.Single(x => x.Product.ProductID == item.Key.ProductID && x.IsHappyHour == item.Value.inventory.IsHappyHour);
|
||||
i.Discount = item.Value.inventory.Discount;
|
||||
i.Price = item.Value.inventory.Price;
|
||||
}
|
||||
if (!_voucher.Printed)
|
||||
{
|
||||
var kot = GetKot(_bill.Where(x => x.Key.BillItemType == BillItemType.Product && x.Key.KotID == Guid.Empty && x.Value.inventory.Quantity != 0));
|
||||
var kot = GetKot(_bill.Where(x => x.Key.KotID == Guid.Empty));
|
||||
if (kot != null)
|
||||
voucher.Kots.Add(kot);
|
||||
}
|
||||
@ -658,7 +657,13 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
var kot = new Kot();
|
||||
foreach (var item in list)
|
||||
{
|
||||
var oldInv = kot.Inventories.SingleOrDefault(x => x.Product.ProductID == item.Key.ProductID);
|
||||
if (item.Key.BillItemType == BillItemType.Kot)
|
||||
continue;
|
||||
if (item.Value.inventory.Quantity == 0)
|
||||
continue;
|
||||
var happyHour = item.Key.BillItemType == BillItemType.HappyHourProduct;
|
||||
var productID = item.Key.ProductID;
|
||||
var oldInv = kot.Inventories.SingleOrDefault(x => x.Product.ProductID == productID && x.IsHappyHour == happyHour);
|
||||
if (oldInv != null)
|
||||
{
|
||||
oldInv.Quantity += item.Value.inventory.Quantity;
|
||||
@ -672,7 +677,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
Product = item.Value.inventory.Product,
|
||||
Quantity = item.Value.inventory.Quantity,
|
||||
Price = item.Value.inventory.Price,
|
||||
FullPrice = item.Value.inventory.FullPrice,
|
||||
IsHappyHour = item.Value.inventory.IsHappyHour,
|
||||
Discount = item.Value.inventory.Discount,
|
||||
ServiceCharge = item.Value.inventory.ServiceCharge,
|
||||
IsScTaxable = item.Value.inventory.IsScTaxable,
|
||||
|
||||
@ -11,6 +11,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
public delegate void ItemChangedHandler();
|
||||
public void Load(Voucher voucher)
|
||||
{
|
||||
this.Clear();
|
||||
foreach (var kot in voucher.Kots)
|
||||
{
|
||||
var kotKey = new BillItemKey(kot.KotID);
|
||||
@ -18,12 +19,13 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
this.Add(kotKey, kotItem);
|
||||
foreach (var inv in kot.Inventories)
|
||||
{
|
||||
var key = new BillItemKey(inv.Product.ProductID, kot.KotID);
|
||||
var key = new BillItemKey(inv.Product.ProductID, kot.KotID, inv.IsHappyHour);
|
||||
var item = new BillItemValue(inv);
|
||||
this.Add(key, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public decimal Tax
|
||||
{
|
||||
get
|
||||
@ -35,7 +37,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Where(x => x.Key.BillItemType != BillItemType.Kot).Sum(i => i.Value.inventory.DiscountAmount);
|
||||
return this.Where(x=>x.Key.BillItemType != BillItemType.Kot).Sum(i => i.Value.inventory.DiscountAmount);
|
||||
}
|
||||
}
|
||||
public decimal ServiceCharge
|
||||
|
||||
@ -37,7 +37,6 @@
|
||||
this.Label2 = new System.Windows.Forms.Label();
|
||||
this.txtUnits = new System.Windows.Forms.TextBox();
|
||||
this.txtName = new System.Windows.Forms.TextBox();
|
||||
this.txtPrice = new System.Windows.Forms.TextBox();
|
||||
this.cmbVat = new System.Windows.Forms.ComboBox();
|
||||
this.bsVat = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.chkIsActive = new System.Windows.Forms.CheckBox();
|
||||
@ -51,8 +50,8 @@
|
||||
this.chkIsScTaxable = new System.Windows.Forms.CheckBox();
|
||||
this.chkIsNotAvailable = new System.Windows.Forms.CheckBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtFullPrice = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.txtPrice = new System.Windows.Forms.TextBox();
|
||||
this.chkHasHappyHour = new System.Windows.Forms.CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsProductGroups)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsServiceTax)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsVat)).BeginInit();
|
||||
@ -118,15 +117,6 @@
|
||||
this.txtName.Size = new System.Drawing.Size(189, 20);
|
||||
this.txtName.TabIndex = 0;
|
||||
//
|
||||
// txtPrice
|
||||
//
|
||||
this.txtPrice.AccessibleName = "";
|
||||
this.txtPrice.Location = new System.Drawing.Point(112, 64);
|
||||
this.txtPrice.Name = "txtPrice";
|
||||
this.txtPrice.Size = new System.Drawing.Size(104, 20);
|
||||
this.txtPrice.TabIndex = 3;
|
||||
this.txtPrice.Text = "0";
|
||||
//
|
||||
// cmbVat
|
||||
//
|
||||
this.cmbVat.DataSource = this.bsVat;
|
||||
@ -249,23 +239,24 @@
|
||||
this.label1.TabIndex = 18;
|
||||
this.label1.Text = "VAT";
|
||||
//
|
||||
// txtFullPrice
|
||||
// txtPrice
|
||||
//
|
||||
this.txtFullPrice.AccessibleName = "";
|
||||
this.txtFullPrice.Location = new System.Drawing.Point(112, 38);
|
||||
this.txtFullPrice.Name = "txtFullPrice";
|
||||
this.txtFullPrice.Size = new System.Drawing.Size(104, 20);
|
||||
this.txtFullPrice.TabIndex = 2;
|
||||
this.txtFullPrice.Text = "0";
|
||||
this.txtPrice.AccessibleName = "";
|
||||
this.txtPrice.Location = new System.Drawing.Point(112, 38);
|
||||
this.txtPrice.Name = "txtPrice";
|
||||
this.txtPrice.Size = new System.Drawing.Size(189, 20);
|
||||
this.txtPrice.TabIndex = 2;
|
||||
this.txtPrice.Text = "0";
|
||||
//
|
||||
// label3
|
||||
// chkHasHappyHour
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(15, 67);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(91, 13);
|
||||
this.label3.TabIndex = 16;
|
||||
this.label3.Text = "Happy Hour Price";
|
||||
this.chkHasHappyHour.AutoSize = true;
|
||||
this.chkHasHappyHour.Location = new System.Drawing.Point(307, 40);
|
||||
this.chkHasHappyHour.Name = "chkHasHappyHour";
|
||||
this.chkHasHappyHour.Size = new System.Drawing.Size(105, 17);
|
||||
this.chkHasHappyHour.TabIndex = 21;
|
||||
this.chkHasHappyHour.Text = "Has Happy Hour";
|
||||
this.chkHasHappyHour.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// ProductForm
|
||||
//
|
||||
@ -273,8 +264,8 @@
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(415, 285);
|
||||
this.Controls.Add(this.txtFullPrice);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.chkHasHappyHour);
|
||||
this.Controls.Add(this.txtPrice);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.chkIsNotAvailable);
|
||||
this.Controls.Add(this.chkIsScTaxable);
|
||||
@ -287,7 +278,6 @@
|
||||
this.Controls.Add(this.chkIsActive);
|
||||
this.Controls.Add(this.txtServiceCharge);
|
||||
this.Controls.Add(this.Label7);
|
||||
this.Controls.Add(this.txtPrice);
|
||||
this.Controls.Add(this.lblServiceCharge);
|
||||
this.Controls.Add(this.cmbVat);
|
||||
this.Controls.Add(this.txtUnits);
|
||||
@ -318,7 +308,6 @@
|
||||
internal System.Windows.Forms.Label Label2;
|
||||
internal System.Windows.Forms.TextBox txtUnits;
|
||||
internal System.Windows.Forms.TextBox txtName;
|
||||
internal System.Windows.Forms.TextBox txtPrice;
|
||||
internal System.Windows.Forms.ComboBox cmbVat;
|
||||
private System.Windows.Forms.CheckBox chkIsActive;
|
||||
internal System.Windows.Forms.TextBox txtServiceCharge;
|
||||
@ -332,7 +321,7 @@
|
||||
private System.Windows.Forms.BindingSource bsVat;
|
||||
private System.Windows.Forms.CheckBox chkIsNotAvailable;
|
||||
internal System.Windows.Forms.Label label1;
|
||||
internal System.Windows.Forms.TextBox txtFullPrice;
|
||||
internal System.Windows.Forms.Label label3;
|
||||
internal System.Windows.Forms.TextBox txtPrice;
|
||||
private System.Windows.Forms.CheckBox chkHasHappyHour;
|
||||
}
|
||||
}
|
||||
@ -29,7 +29,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
txtName.Text = product.Name;
|
||||
txtUnits.Text = product.Units;
|
||||
txtPrice.Text = product.Price.ToString("#.##");
|
||||
txtFullPrice.Text = product.FullPrice.ToString("#.##");
|
||||
chkHasHappyHour.Checked = product.HasHappyHour;
|
||||
cmbVat.SelectedValue = product.Vat.TaxID;
|
||||
cmbServiceTax.SelectedValue = product.ServiceTax.TaxID;
|
||||
txtServiceCharge.Text = product.ServiceCharge.ToString("#.##");
|
||||
@ -95,24 +95,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
else
|
||||
product.Price = decimal.Parse(txtPrice.Text.Trim());
|
||||
|
||||
if (string.IsNullOrEmpty(txtFullPrice.Text.Trim()))
|
||||
txtFullPrice.Text = "0";
|
||||
if (!Regex.IsMatch(txtFullPrice.Text, @"^\d*([.]\d{1,5})?$"))
|
||||
{
|
||||
MessageBox.Show("Full Price is not valid, it must be a decimal >= 0");
|
||||
txtFullPrice.Focus();
|
||||
return;
|
||||
}
|
||||
else
|
||||
product.FullPrice = decimal.Parse(txtFullPrice.Text.Trim());
|
||||
|
||||
if (product.FullPrice < product.Price)
|
||||
{
|
||||
MessageBox.Show("Full Price cannot be less than the actual price.");
|
||||
txtFullPrice.Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
// Tax
|
||||
if (cmbVat.SelectedItem == null)
|
||||
{
|
||||
|
||||
@ -126,6 +126,9 @@
|
||||
<metadata name="bsVat.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>382, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsVat.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>382, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>102</value>
|
||||
</metadata>
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
@ -12,6 +13,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
public FrmSaleDetail()
|
||||
{
|
||||
InitializeComponent();
|
||||
dgvSale.AutoGenerateColumns = false;
|
||||
}
|
||||
|
||||
private void dtpStart_ValueChanged(object sender, EventArgs e)
|
||||
@ -23,16 +25,18 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
if (DateTime.Today.Subtract(dtpStart.Value.Date).Days > 5 && !Session.IsAllowed("Accounts Audit"))
|
||||
return;
|
||||
_list = new ReportsBI().GetSaleDetail(dtpStart.Value, dtpFinish.Value);
|
||||
dgvSale.AutoGenerateColumns = true;
|
||||
var bi = new ReportsBI();
|
||||
_list = bi.SaleQuantity(dtpStart.Value, dtpFinish.Value);
|
||||
|
||||
foreach (var item in bi.NcQuantity(dtpStart.Value, dtpFinish.Value))
|
||||
{
|
||||
var old = _list.FirstOrDefault(x => x.ProductID == item.ProductID);
|
||||
if (old != null)
|
||||
old.NC = item.NC;
|
||||
else
|
||||
_list.Add(new SalesAnalysisDetail() { Name = item.Name, ProductID = item.ProductID, NC = item.NC });
|
||||
}
|
||||
dgvSale.DataSource = _list;
|
||||
dgvSale.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
dgvSale.Columns[1].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
|
||||
dgvSale.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
||||
dgvSale.Columns[2].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
|
||||
dgvSale.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
||||
dgvSale.Columns[3].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
|
||||
dgvSale.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
||||
}
|
||||
|
||||
private void dtpFinish_ValueChanged(object sender, EventArgs e)
|
||||
@ -65,10 +69,11 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
if (_list == null)
|
||||
return;
|
||||
var data = string.Format("{0}\t{1}\t{2}\t{3}\n", "Product", "Sale", "NC", "Staff");
|
||||
var data = string.Format("{0}\t{1}\t{2}\t{3}\n", "ProductID", "Product", "Sale", "NC");
|
||||
foreach (var item in _list)
|
||||
{
|
||||
data += string.Format("{0}\t{1}\t{2}\t{3}\n", item.Product, item.Sale, item.NC, item.Staff);
|
||||
|
||||
data += string.Format("{0}\t{1}\t{2}\t{3}\n", item.ProductID, item.Name, item.Sale, item.NC);
|
||||
}
|
||||
Clipboard.SetText(data, TextDataFormat.Text);
|
||||
}
|
||||
|
||||
@ -28,6 +28,8 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.dgvSale = new System.Windows.Forms.DataGridView();
|
||||
this.dtpFinish = new System.Windows.Forms.DateTimePicker();
|
||||
this.dtpStart = new System.Windows.Forms.DateTimePicker();
|
||||
@ -35,6 +37,9 @@
|
||||
this.btnPrint = new System.Windows.Forms.Button();
|
||||
this.btnExport = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.NameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Sale = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.NC = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvSale)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -46,7 +51,12 @@
|
||||
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.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
this.dgvSale.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvSale.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.NameColumn,
|
||||
this.Sale,
|
||||
this.NC});
|
||||
this.dgvSale.Location = new System.Drawing.Point(12, 41);
|
||||
this.dgvSale.MultiSelect = false;
|
||||
this.dgvSale.Name = "dgvSale";
|
||||
@ -120,6 +130,34 @@
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// NameColumn
|
||||
//
|
||||
this.NameColumn.DataPropertyName = "Name";
|
||||
this.NameColumn.HeaderText = "Name";
|
||||
this.NameColumn.Name = "NameColumn";
|
||||
this.NameColumn.ReadOnly = true;
|
||||
this.NameColumn.Width = 60;
|
||||
//
|
||||
// Sale
|
||||
//
|
||||
this.Sale.DataPropertyName = "Sale";
|
||||
dataGridViewCellStyle1.Format = "#,##0.00;(#,##0.00);0";
|
||||
this.Sale.DefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.Sale.HeaderText = "Sale";
|
||||
this.Sale.Name = "Sale";
|
||||
this.Sale.ReadOnly = true;
|
||||
this.Sale.Width = 53;
|
||||
//
|
||||
// NC
|
||||
//
|
||||
this.NC.DataPropertyName = "NC";
|
||||
dataGridViewCellStyle2.Format = "#,##0.00;(#,##0.00);0";
|
||||
this.NC.DefaultCellStyle = dataGridViewCellStyle2;
|
||||
this.NC.HeaderText = "NC";
|
||||
this.NC.Name = "NC";
|
||||
this.NC.ReadOnly = true;
|
||||
this.NC.Width = 47;
|
||||
//
|
||||
// FrmSaleDetail
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -152,5 +190,8 @@
|
||||
private System.Windows.Forms.Button btnPrint;
|
||||
private System.Windows.Forms.Button btnExport;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn NameColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Sale;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn NC;
|
||||
}
|
||||
}
|
||||
@ -117,4 +117,13 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="NameColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Sale.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="NC.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@ -30,6 +30,7 @@
|
||||
{
|
||||
this.flpModifier = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.btnClose = new System.Windows.Forms.Button();
|
||||
this.flpModifier.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// flpModifier
|
||||
@ -61,11 +62,13 @@
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.btnClose);
|
||||
this.Controls.Add(this.flpModifier);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "ModifierForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Modifier";
|
||||
this.Load += new System.EventHandler(this.ModifierForm_Load);
|
||||
this.flpModifier.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
@ -28,11 +28,14 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
private void button_Click(object sender, EventArgs e)
|
||||
{
|
||||
CheckBox button = sender as CheckBox;
|
||||
if (button == null)
|
||||
return;
|
||||
if (button.CheckState == CheckState.Checked)
|
||||
selection.Add(new InventoryModifier() { Modifier = (Modifier)button.Tag });
|
||||
else
|
||||
selection.Remove(selection.First(x => x.Modifier.ModifierID == ((Modifier)button.Tag).ModifierID));
|
||||
}
|
||||
|
||||
private void ModifierForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
var size = new Point(75, 75);
|
||||
@ -70,6 +73,5 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
//
|
||||
// quantityColumn
|
||||
//
|
||||
this.quantityColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
|
||||
this.quantityColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
|
||||
this.quantityColumn.DataPropertyName = "Quantity";
|
||||
dgvCellStyleQuantity.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
|
||||
dgvCellStyleQuantity.Format = "N2";
|
||||
@ -344,7 +344,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
this.btnPrice.Name = "btnPrice";
|
||||
this.btnPrice.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnPrice.TabIndex = 146;
|
||||
this.btnPrice.Text = "btnPrice";
|
||||
this.btnPrice.Text = "Price";
|
||||
this.btnPrice.UseVisualStyleBackColor = true;
|
||||
this.btnPrice.Click += new System.EventHandler(this.btnPrice_Click);
|
||||
//
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
@ -355,7 +356,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
return;
|
||||
_controller.AddProduct(item);
|
||||
bindingSource.DataSource = _controller._bill.ToList();
|
||||
bindingSource.CurrencyManager.Position = _controller._bill.IndexOfKey(new BillItemKey(item.ProductID, Guid.Empty));
|
||||
bindingSource.CurrencyManager.Position = _controller._bill.IndexOfKey(new BillItemKey(item.ProductID, Guid.Empty, item.HasHappyHour));
|
||||
|
||||
var showModifier = false;
|
||||
using (var bi = new ProductGroupModifierBI())
|
||||
|
||||
@ -123,6 +123,12 @@
|
||||
<metadata name="bindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="Display.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="bindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>81</value>
|
||||
</metadata>
|
||||
|
||||
119
Tanshu.Accounts.PointOfSale/Sales/VoidReasonListForm.Designer.cs
generated
Normal file
119
Tanshu.Accounts.PointOfSale/Sales/VoidReasonListForm.Designer.cs
generated
Normal file
@ -0,0 +1,119 @@
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
partial class VoidReasonListForm
|
||||
{
|
||||
/// <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.components = new System.ComponentModel.Container();
|
||||
this.btnExit = new System.Windows.Forms.Button();
|
||||
this.dgvVoidReasons = new System.Windows.Forms.DataGridView();
|
||||
this.bsList = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.info = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvVoidReasons)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsList)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnExit
|
||||
//
|
||||
this.btnExit.AccessibleName = "Done";
|
||||
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnExit.Location = new System.Drawing.Point(575, 255);
|
||||
this.btnExit.Name = "btnExit";
|
||||
this.btnExit.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnExit.TabIndex = 61;
|
||||
this.btnExit.Text = "E&xit";
|
||||
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
|
||||
//
|
||||
// dgvVoidReasons
|
||||
//
|
||||
this.dgvVoidReasons.AllowUserToAddRows = false;
|
||||
this.dgvVoidReasons.AllowUserToDeleteRows = false;
|
||||
this.dgvVoidReasons.AllowUserToResizeRows = false;
|
||||
this.dgvVoidReasons.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.dgvVoidReasons.AutoGenerateColumns = false;
|
||||
this.dgvVoidReasons.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
this.dgvVoidReasons.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvVoidReasons.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.info});
|
||||
this.dgvVoidReasons.DataSource = this.bsList;
|
||||
this.dgvVoidReasons.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
|
||||
this.dgvVoidReasons.Location = new System.Drawing.Point(12, 12);
|
||||
this.dgvVoidReasons.MultiSelect = false;
|
||||
this.dgvVoidReasons.Name = "dgvVoidReasons";
|
||||
this.dgvVoidReasons.ReadOnly = true;
|
||||
this.dgvVoidReasons.RowHeadersVisible = false;
|
||||
this.dgvVoidReasons.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
|
||||
this.dgvVoidReasons.RowTemplate.Height = 24;
|
||||
this.dgvVoidReasons.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.dgvVoidReasons.Size = new System.Drawing.Size(638, 237);
|
||||
this.dgvVoidReasons.TabIndex = 74;
|
||||
this.dgvVoidReasons.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvVoidReasons_CellDoubleClick);
|
||||
this.dgvVoidReasons.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgvVoidReasons_CellFormatting);
|
||||
//
|
||||
// bsList
|
||||
//
|
||||
this.bsList.DataSource = typeof(string);
|
||||
//
|
||||
// info
|
||||
//
|
||||
this.info.HeaderText = "Info";
|
||||
this.info.Name = "info";
|
||||
this.info.ReadOnly = true;
|
||||
this.info.Width = 50;
|
||||
//
|
||||
// VoidReasonListForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(662, 342);
|
||||
this.Controls.Add(this.dgvVoidReasons);
|
||||
this.Controls.Add(this.btnExit);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "VoidReasonListForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Customers";
|
||||
this.Load += new System.EventHandler(this.VoidReasonListForm_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvVoidReasons)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsList)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
internal System.Windows.Forms.Button btnExit;
|
||||
private System.Windows.Forms.DataGridView dgvVoidReasons;
|
||||
private System.Windows.Forms.BindingSource bsList;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Password;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn CustomerGroups;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn info;
|
||||
}
|
||||
}
|
||||
60
Tanshu.Accounts.PointOfSale/Sales/VoidReasonListForm.cs
Normal file
60
Tanshu.Accounts.PointOfSale/Sales/VoidReasonListForm.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using System.Collections.Generic;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class VoidReasonListForm : Form
|
||||
{
|
||||
private string[] _list;
|
||||
public VoidReasonListForm(string[] list)
|
||||
{
|
||||
_list = list;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void VoidReasonListForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
bsList.DataSource = _list;
|
||||
}
|
||||
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
public string SelectedItem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (bsList.Position >= 0)
|
||||
{
|
||||
var item = _list[bsList.Position];
|
||||
if (item != null)
|
||||
return item;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void dgvVoidReasons_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void dgvVoidReasons_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||
{
|
||||
var data = dgvVoidReasons.Rows[e.RowIndex].DataBoundItem as string;
|
||||
if (e.ColumnIndex == dgvVoidReasons.Columns["Info"].Index)
|
||||
{
|
||||
e.Value = data;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
126
Tanshu.Accounts.PointOfSale/Sales/VoidReasonListForm.resx
Normal file
126
Tanshu.Accounts.PointOfSale/Sales/VoidReasonListForm.resx
Normal file
@ -0,0 +1,126 @@
|
||||
<?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>
|
||||
<metadata name="info.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="bsList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@ -194,6 +194,12 @@
|
||||
<Compile Include="Masters\ReorderTableForm.Designer.cs">
|
||||
<DependentUpon>ReorderTableForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Sales\VoidReasonListForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Sales\VoidReasonListForm.Designer.cs">
|
||||
<DependentUpon>VoidReasonListForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Sales\CustomerListForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -377,6 +383,10 @@
|
||||
<EmbeddedResource Include="Masters\ReorderTableForm.resx">
|
||||
<DependentUpon>ReorderTableForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Sales\VoidReasonListForm.resx">
|
||||
<DependentUpon>VoidReasonListForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Sales\CustomerListForm.resx">
|
||||
<DependentUpon>CustomerListForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
Reference in New Issue
Block a user