public clsAccountInfo(int accountid) { dbConnect con = new dbConnect(); clsAccountInfo account = con.GetAccountInfo(accountid); if (account != null) { AccountId = account.AccountId; AccountName = account.AccountName; CreditLimit = account.CreditLimit; YTDTransaction = account.YTDTransaction; PrincipalBalance = account.PrincipalBalance; TotalInterest = account.TotalInterest; } con.Close(); }
public string PrintNew(int printFor = 0) { string ret = ""; InitializePrinter(); ret += PrintHeader(new List <string>() { Properties.Settings.Default.Company, Properties.Settings.Default.Address1, Properties.Settings.Default.Address2 }, PrintFontAlignment.Center, PrintFontSize.MediumReg); if (Properties.Settings.Default.PrintTIN) { ret += PrintHeader(new List <string>() { Properties.Settings.Default.TIN }, PrintFontAlignment.Center, PrintFontSize.MediumReg); } if (printFor == 4) { ret += PrintAppend(new List <string>() { string.Format("Customer: {0}", CashierName.ToUpper()), string.Format("Date: {0}", this.TransDate.ToString("yyyy-MM-dd HH:mm:ss")) }, PrintFontAlignment.Left, PrintFontSize.Regular); } else { ret += PrintAppend(new List <string>() { string.Format("Cashier: {0}", CashierName.ToUpper()), string.Format("Date: {0}", this.TransDate.ToString("yyyy-MM-dd HH:mm:ss")), string.Format("Invoice Number: {0}", ORNumber) }, PrintFontAlignment.Left, PrintFontSize.Regular); } List <string> strmsg = new List <string>(); if (printFor == 1) { strmsg.Add("Customer's Copy"); } else if (printFor == 2) { strmsg.Add("Duplicate Copy"); } else if (printFor == 3) { strmsg.Add("Reprint"); } else if (printFor == 4) { strmsg.Add("Partial Billing"); } strmsg.Add("_______________________________________"); foreach (clsPurchasedItem item in _lstPurchasedItems.Values) { strmsg.Add(String.Format("Item code: {0}", item.BarCode)); strmsg.Add(String.Format(" {0}", item.Description)); strmsg.Add(String.Format(" {0} {3}@P {1:0.00}\tP {2:0.00}", item.Qty, item.Amount - item.Discount, item.Total - (item.Discount * item.Qty), item.Unit)); } strmsg.Add("_______________________________________"); strmsg.Add(string.Format(" Items :\t {0}", TotalQty)); if (TotalAmountDue > TotalDiscountedAmount) { strmsg.Add(string.Format(" Before Disc :\tP {0:0.00}", TotalAmountDue)); strmsg.Add(string.Format(" Items Disc :\tP {0:0.00}", ItemDiscount)); } strmsg.Add(string.Format(" Grand Total :\tP {0:0.00}", TotalDiscountedAmount)); strmsg.Add(string.Format(" Tendered Amount :\tP {0:0.00}", CashTendered)); strmsg.Add(string.Format(" Change Amount :\tP {0:0.00}", ChangeAmount)); ret += PrintAppend(strmsg, PrintFontAlignment.Left, PrintFontSize.SmallBold); strmsg.Clear(); if (ChargeTrans != null) { strmsg.Add(" "); strmsg.Add(string.Format(" Account Name :\t{0}", ChargeTrans.AccountName)); clsAccountInfo act = clsAccountInfo.GetAccounts(ChargeTrans.AccountName)[0]; strmsg.Add(string.Format(" Previous Balance :\tP {0:0.00}", ChargeTrans.PrevBalance)); strmsg.Add(string.Format(" Amount Charged :\tP {0:0.00}", ChargeTrans.ChargedAmount)); strmsg.Add(string.Format(" Outstanding Balance:\tP {0:0.00}", ChargeTrans.CurrBalance)); strmsg.Add(string.Format(" _________________________________")); strmsg.Add(string.Format(" YTD Trans :\tP {0:0.00}", act.YTDTransaction)); strmsg.Add(string.Format(" ")); } if (Properties.Settings.Default.PrintVat) { strmsg.Add("_______________________________________"); strmsg.Add(string.Format(" VATable \t\tP {0:0.00}", TotalDiscountedAmount / (1 + (Properties.Settings.Default.VatPercentage / 100)))); strmsg.Add(string.Format(" VAT - {1}% \t\tP {0:0.00}", (TotalDiscountedAmount / (1 + (Properties.Settings.Default.VatPercentage / 100)) * (Properties.Settings.Default.VatPercentage / 100)), Properties.Settings.Default.VatPercentage)); strmsg.Add(string.Format(" Amount Due\t\tP {0:0.00}", TotalDiscountedAmount)); } if (this.SeniorDiscount > 0) { strmsg.Add("_______________________________________"); strmsg.Add("\n"); strmsg.Add("Senior Citizen Discount"); strmsg.Add("\n"); strmsg.Add("Name: ________________________"); strmsg.Add("\n"); strmsg.Add("Address: _____________________"); strmsg.Add("\n"); strmsg.Add("Signature: ___________________"); } ret += PrintAppend(strmsg, PrintFontAlignment.Left, PrintFontSize.SmallBold); strmsg.Clear(); if (Properties.Settings.Default.PrintMessage) { strmsg.Add("_______________________________________"); strmsg.Add(Properties.Settings.Default.Message1); strmsg.Add(Properties.Settings.Default.Message2); if (Properties.Settings.Default.Message3 != "") { strmsg.Add(Properties.Settings.Default.Message3); } strmsg.Add("_______________________________________"); } ret += PrintCenter(strmsg); if (Properties.Settings.Default.PrintORBarcode) { PrintBarcode(ORNumber.ToString("999900000000")); } else { PrintCenter(new List <string>() { " ", " " }); } FormFeed(); if (PaidAmount > 0) { OpenDrawer(); } ExecPrint(); frmPrintReceipt pr = new frmPrintReceipt(ret); pr.ShowDialog(); return(ret); }