public void Save(bool modifyPurchases = false) { dbConnect dbCon = new dbConnect(); Int32 receiptid = this.ORNumber; if (dbCon.CreateReceipt(ref receiptid, this.CashierName, this.TotalAmountDue, this.CashTendered, this.SeniorDiscount, this.ItemDiscount, this.Accountid, this.TransDate) == false) { return; } if (this.ORNumber != receiptid || this.ORNumber == receiptid && modifyPurchases) { this.ORNumber = receiptid; dbCon.RemoveFromHistory(this._ORNumber); foreach (KeyValuePair <string, clsPurchasedItem> purchaseditem in _lstPurchasedItems) { if (purchaseditem.Value.Qty > 0) { purchaseditem.Value.ORNumber = this.ORNumber; if (dbCon.AddTransaction(purchaseditem.Value)) { clsProductItem prod = clsProductItem.SearchProduct(purchaseditem.Value.BarCode); prod.QtySold += purchaseditem.Value.Qty; prod.Save(); } } } } this.ORNumber = receiptid; dbCon.Close(); }
private void SearchPurchases(DateTime startdate, DateTime enddate, string cashier) { List <Receipt> lstReceipt = new List <Receipt>(); dbConnect con = new dbConnect(); TotalIncome = 0.0; NetProfit = 0.0; TotalAccountsReceivable = 0.0; lstReceipt = con.GetReceiptInfo(startdate, enddate, cashier); con.Close(); dgvPurchase.Rows.Clear(); dgvSenior.Rows.Clear(); dgvAccounts.Rows.Clear(); dgvPayments.Rows.Clear(); TotalQty = 0; foreach (Receipt r in lstReceipt) { AddItemToGridReceipt(r); AddAccountsReceivableItemToGrid(r); //AddItemToGrid(r); TotalIncome += (r.TotalDiscountedAmount > r.CashTendered ? r.CashTendered : r.TotalDiscountedAmount); NetProfit += (r.TotalDiscountedAmount - r.TotalCapital); } lblTotalSales.Text = string.Format("Total Sales: P {0:0.00}", TotalIncome); lblNetProfit.Text = string.Format("Net Profit: P {0:0.00}", NetProfit); lblReceivable.Text = string.Format("Receivable: P {0:0.00}", TotalAccountsReceivable); lblItems.Text = "Total Qty:" + TotalQty; }
private void BackupData() { if (clsUtil.GetApproval(m_user, UserAccess.Manager)) { string directory = Path.GetDirectoryName(Application.ExecutablePath); directory = directory.Substring(0, directory.LastIndexOf("\\")); string backup = directory + "\\iPOSBackup"; string filename = string.Format("{0}\\backup_{1:yyyMMdd_HHmm}.mdb", backup, DateTime.Now); if (!Directory.Exists(backup)) { Directory.CreateDirectory(backup); } dbConnect con = new dbConnect(); string dbName = con.GetDatabaseName(); con.Close(); try { File.Copy(dbName, filename, true); MessageBox.Show(string.Format("Backup was saved successfully to {0}", filename), "Backup", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Backup Failed", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } }
public bool Save() { dbConnect con = new dbConnect(); bool ret = con.SaveCheckOut(this); if (ret && this.LstItems.Count > 0) { this.Id = clsCheckOut.GetCheckOutID(this.Timestamp, this.UserName); con.DeleteCheckOutItem(this.Id); foreach (clsCheckOutItem chkOutItem in this.LstItems) { chkOutItem.CheckOutId = this.Id; if (chkOutItem.ActualAmount - chkOutItem.ExpectedAmount != 0) { chkOutItem.Remarks = string.Format("{0} [{1:0.00}]", chkOutItem.ActualAmount - chkOutItem.ExpectedAmount > 0 ? "Over" : (chkOutItem.ActualAmount - chkOutItem.ExpectedAmount == 0 ? "Match" : "Short"), chkOutItem.ActualAmount - chkOutItem.ExpectedAmount); } else { chkOutItem.Remarks = "Match"; } chkOutItem.Save(); } } con.Close(); return(ret); }
public void SaveHistory() { dbConnect connect = new dbConnect(); connect.InsertInventoryHistory(this._or_num, this._desc, this._amount, this._qty, this._barcode, this._date); connect.Close(); }
public void Delete(int inventoryid) { dbConnect connect = new dbConnect(); connect.DeleteInventoryItem(inventoryid); connect.Close(); }
public void SaveTemp(string CustomerName, bool modifyPurchases = false) { dbConnect dbCon = new dbConnect(); Int32 receiptid = this.ORNumber; if (dbCon.CreateTempReceipt(ref receiptid, CustomerName, this.TotalAmountDue, this.CashTendered, this.SeniorDiscount, this.ItemDiscount, this.Accountid) == false) { return; } if (this.ORNumber != receiptid || this.ORNumber == receiptid && modifyPurchases) { this.ORNumber = receiptid; dbCon.RemoveFromTempHistory(this._ORNumber); foreach (KeyValuePair <string, clsPurchasedItem> purchaseditem in _lstPurchasedItems) { if (purchaseditem.Value.Qty > 0) { purchaseditem.Value.ORNumber = this.ORNumber; dbCon.AddTempTransaction(purchaseditem.Value); } } } dbCon.Close(); }
public bool Save() { dbConnect con = new dbConnect(); bool ret = con.SaveUser(this); con.Close(); return(ret); }
public bool Save() { dbConnect con = new dbConnect(); bool ret = con.SaveCheckOutItem(this); con.Close(); return(ret); }
public static List <clsInventory> GetPurchases(DateTime startdate, DateTime enddate, string remarks) { dbConnect con = new dbConnect(); List <clsInventory> ret = con.GetPurchases(startdate, enddate, remarks); con.Close(); return(ret); }
public static double GetInitialCash(DateTime date, string username) { dbConnect con = new dbConnect(); double amount = con.GetInitialCash(date, username); con.Close(); return(amount); }
public static List <clsUsers> GetUsers() { dbConnect con = new dbConnect(); List <clsUsers> ret = con.GetUsers(); con.Close(); return(ret); }
public static List <clsProductItem> SearchProductItems(string searchString) { dbConnect connect = new dbConnect(); List <clsProductItem> lstProd = connect.SearchProductItems(searchString); connect.Close(); return(lstProd); }
public static bool DeleteProductItem(Int32 id) { dbConnect connect = new dbConnect(); bool ret = connect.DeleteProductItem(id); connect.Close(); return(ret); }
public static bool Delete(string barcode) { dbConnect connect = new dbConnect(); bool ret = connect.DeleteProductItem(barcode); connect.Close(); return(ret); }
public static clsChargedLoadTrans GetChargedTransaction(int loadwallettransid) { dbConnect con = new dbConnect(); clsChargedLoadTrans trans = con.GetChargedLoadTransaction(loadwallettransid); con.Close(); return(trans); }
public static double GetTotalExpenses(DateTime dateStart, DateTime dateEnd, string cashier = "") { dbConnect con = new dbConnect(); double lstExp = con.GetTotalExpenses(dateStart, dateEnd, cashier); con.Close(); return(lstExp); }
public static List <clsExpenses> GetExpenses(DateTime dateStart, DateTime dateEnd, string cashier = "") { dbConnect con = new dbConnect(); List <clsExpenses> lstExp = con.GetExpenses(dateStart, dateEnd, cashier); con.Close(); return(lstExp); }
public static bool Delete(int expenseid) { dbConnect con = new dbConnect(); bool ret = con.DeleteExpenses(expenseid); con.Close(); return(ret); }
public bool UsernameExists(string username) { dbConnect con = new dbConnect(); bool ret = con.UserNameExists(username); con.Close(); return(ret); }
public static List <string> GetUserList() { dbConnect con = new dbConnect(); List <string> ret = con.GetUser(); con.Close(); return(ret); }
public static clsProductItem SearchProduct(string barcode) { dbConnect connect = new dbConnect(); clsProductItem item = connect.GetProductItem(barcode); connect.Close(); return(item); }
public static bool Delete(int initCashid) { dbConnect con = new dbConnect(); bool ret = con.DeleteInitialCash(initCashid); con.Close(); return(ret); }
public static double GetCashDeposit(DateTime date, int userid) { dbConnect con = new dbConnect(); double amount = con.GetDepositCash(date, userid); con.Close(); return(amount); }
public bool SaveChargeTransaction() { dbConnect con = new dbConnect(); bool ret = con.SaveChargedTransaction(this); con.Close(); return(ret); }
public static List <clsInventory> lstInventory(string BarCode) { dbConnect con = new dbConnect(); List <clsInventory> ret = con.getInventory(BarCode); con.Close(); return(ret); }
public static int ChangeBarcode(string oldBarcode, string newBarcode) { dbConnect connect = new dbConnect(); int ret = connect.ChangeBarcode(oldBarcode, newBarcode); connect.Close(); return(ret); }
public bool Delete() { dbConnect con = new dbConnect(); bool ret = con.DeleteServiceFee(this.ServiceFeeID); con.Close(); return(ret); }
public static clsChargedTransaction GetChargedTransaction(int ornum) { dbConnect con = new dbConnect(); clsChargedTransaction trans = con.GetChargedTransaction(ornum); con.Close(); return(trans); }
public static List <clsCheckOutItem> GetCheckOutItems(int checkoutId) { dbConnect con = new dbConnect(); List <clsCheckOutItem> lstCheckoutItems = con.GetCheckOutItems(checkoutId); con.Close(); return(lstCheckoutItems); }