public Int32 Save(PLUReportDetails Details) { try { MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; string SQL = "CALL procSavePLUReport(@BranchID, @TerminalNo, @PLUReportID, @ProductID, @ProductCode, @ProductGroup, @Quantity, @Amount, @OrderSlipPrinter, @CreatedOn, @LastModified);"; cmd.Parameters.AddWithValue("BranchID", Details.BranchDetails.BranchID); cmd.Parameters.AddWithValue("TerminalNo", Details.TerminalNo); cmd.Parameters.AddWithValue("PLUReportID", Details.PLUReportID); cmd.Parameters.AddWithValue("ProductID", Details.ProductID); cmd.Parameters.AddWithValue("ProductCode", Details.ProductCode); cmd.Parameters.AddWithValue("ProductGroup", Details.ProductGroup); cmd.Parameters.AddWithValue("Quantity", Details.Quantity); cmd.Parameters.AddWithValue("Amount", Details.Amount); cmd.Parameters.AddWithValue("OrderSlipPrinter", Details.OrderSlipPrinter); cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn); cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified); cmd.CommandText = SQL; return base.ExecuteNonQuery(cmd); } catch (Exception ex) { throw base.ThrowException(ex); } }
public Int32 Save(PLUReportDetails Details) { try { MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; string SQL = "CALL procSavePLUReport(@BranchID, @TerminalNo, @PLUReportID, @ProductID, @ProductCode, @ProductGroup, @Quantity, @Amount, @OrderSlipPrinter, @CreatedOn, @LastModified);"; cmd.Parameters.AddWithValue("BranchID", Details.BranchDetails.BranchID); cmd.Parameters.AddWithValue("TerminalNo", Details.TerminalNo); cmd.Parameters.AddWithValue("PLUReportID", Details.PLUReportID); cmd.Parameters.AddWithValue("ProductID", Details.ProductID); cmd.Parameters.AddWithValue("ProductCode", Details.ProductCode); cmd.Parameters.AddWithValue("ProductGroup", Details.ProductGroup); cmd.Parameters.AddWithValue("Quantity", Details.Quantity); cmd.Parameters.AddWithValue("Amount", Details.Amount); cmd.Parameters.AddWithValue("OrderSlipPrinter", Details.OrderSlipPrinter); cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn); cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified); cmd.CommandText = SQL; return(base.ExecuteNonQuery(cmd)); } catch (Exception ex) { throw base.ThrowException(ex); } }
/// <summary> /// This should only be called by GeneratePLUReport. /// tblPLUReport is a temp table for session reporting purposes only. /// </summary> /// <param name="Details"></param> /// <returns></returns> public Int64 Insert(PLUReportDetails Details) { try { Save(Details); return Int64.Parse(base.getLAST_INSERT_ID(this)); } catch (Exception ex) { throw base.ThrowException(ex); } }
/// <summary> /// This should only be called by GeneratePLUReport. /// tblPLUReport is a temp table for session reporting purposes only. /// </summary> /// <param name="Details"></param> /// <returns></returns> public Int64 Insert(PLUReportDetails Details) { try { Save(Details); return(Int64.Parse(base.getLAST_INSERT_ID(this))); } catch (Exception ex) { throw base.ThrowException(ex); } }
public void GeneratePLUReport(Int32 BranchID, string TerminalNo, bool isPerGroup, string CashierName) { try { System.Data.DataTable dtPLUReport = this.PLUReport(BranchID, TerminalNo, CashierName, isPerGroup); Data.PLUReport clsPLUReport = new Data.PLUReport(base.Connection, base.Transaction); clsPLUReport.Delete(BranchID, TerminalNo); PLUReportDetails clsPLUReportDetails; ProductComposition clsProductComposition = new ProductComposition(base.Connection, base.Transaction); foreach(System.Data.DataRow dr in dtPLUReport.Rows) { long lProductID = Convert.ToInt64(dr["ProductID"]); string stProductCode = dr["ProductCode"].ToString(); string stProductGroup = dr["ProductGroup"].ToString(); decimal decQuantity = Convert.ToDecimal(dr["Quantity"]); decimal decAmount = Convert.ToDecimal(dr["Amount"]); bool boOrderSlipPrinter1 = bool.Parse(dr["OrderSlipPrinter1"].ToString()); bool boOrderSlipPrinter2 = bool.Parse(dr["OrderSlipPrinter2"].ToString()); bool boOrderSlipPrinter3 = bool.Parse(dr["OrderSlipPrinter3"].ToString()); bool boOrderSlipPrinter4 = bool.Parse(dr["OrderSlipPrinter4"].ToString()); bool boOrderSlipPrinter5 = bool.Parse(dr["OrderSlipPrinter5"].ToString()); // 07Apr2015 : Add this so that those products without OrderSlipPrinter will be defaulted to OrderSlipPrinter1 if (!boOrderSlipPrinter1 && !boOrderSlipPrinter2 && !boOrderSlipPrinter3 && !boOrderSlipPrinter4 && !boOrderSlipPrinter5) boOrderSlipPrinter1 = true; clsPLUReportDetails = new PLUReportDetails(); clsPLUReportDetails.BranchDetails = new BranchDetails { BranchID = BranchID }; clsPLUReportDetails.TerminalNo = TerminalNo; clsPLUReportDetails.ProductID = lProductID; clsPLUReportDetails.ProductCode = stProductCode; clsPLUReportDetails.ProductGroup = stProductGroup; clsPLUReportDetails.Quantity = decQuantity; clsPLUReportDetails.Amount = decAmount; if (boOrderSlipPrinter1) { clsPLUReportDetails.OrderSlipPrinter = OrderSlipPrinter.RetailPlusOSPrinter1; clsPLUReport.Insert(clsPLUReportDetails); } if (boOrderSlipPrinter2) { clsPLUReportDetails.OrderSlipPrinter = OrderSlipPrinter.RetailPlusOSPrinter2; clsPLUReport.Insert(clsPLUReportDetails); } if (boOrderSlipPrinter3) { clsPLUReportDetails.OrderSlipPrinter = OrderSlipPrinter.RetailPlusOSPrinter3; clsPLUReport.Insert(clsPLUReportDetails); } if (boOrderSlipPrinter4) { clsPLUReportDetails.OrderSlipPrinter = OrderSlipPrinter.RetailPlusOSPrinter4; clsPLUReport.Insert(clsPLUReportDetails); } if (boOrderSlipPrinter5) { clsPLUReportDetails.OrderSlipPrinter = OrderSlipPrinter.RetailPlusOSPrinter5; clsPLUReport.Insert(clsPLUReportDetails); } // generate if per item if (!isPerGroup) clsProductComposition.GeneratePLUReport(BranchID, TerminalNo, lProductID, stProductCode, decQuantity); } } catch (Exception ex) { throw base.ThrowException(ex); } }
// returns True if a composition exist // returns False if a composition does not exist public bool GeneratePLUReport(Int32 BranchID, string TerminalNo, long MainProductID, string MainProductCode, decimal Quantity) { try { bool boRetValue = false; System.Data.DataTable dtCompositionList = ListAsDataTable(MainProductID, "CompositionID", SortOption.Ascending); Data.PLUReport clsPLUReport = new Data.PLUReport(base.Connection, base.Transaction); PLUReportDetails clsPLUReportDetails; foreach (System.Data.DataRow dr in dtCompositionList.Rows) { long lProductID = Convert.ToInt64(dr["ProductID"]); string stProductCode = dr["ProductCode"].ToString(); decimal decQuantity = Convert.ToDecimal(Convert.ToDecimal(dr["Quantity"]) * Quantity); bool boOrderSlipPrinter1 = bool.Parse(dr["OrderSlipPrinter1"].ToString()); bool boOrderSlipPrinter2 = bool.Parse(dr["OrderSlipPrinter2"].ToString()); bool boOrderSlipPrinter3 = bool.Parse(dr["OrderSlipPrinter3"].ToString()); bool boOrderSlipPrinter4 = bool.Parse(dr["OrderSlipPrinter4"].ToString()); bool boOrderSlipPrinter5 = bool.Parse(dr["OrderSlipPrinter5"].ToString()); clsPLUReportDetails = new PLUReportDetails(); clsPLUReportDetails.BranchDetails = new BranchDetails { BranchID = BranchID }; clsPLUReportDetails.TerminalNo = TerminalNo; clsPLUReportDetails.ProductID = lProductID; clsPLUReportDetails.ProductCode = MainProductCode + "-" + stProductCode; clsPLUReportDetails.Quantity = decQuantity; clsPLUReportDetails.Amount = 0; if (boOrderSlipPrinter1) { clsPLUReportDetails.OrderSlipPrinter = OrderSlipPrinter.RetailPlusOSPrinter1; clsPLUReport.Insert(clsPLUReportDetails); } if (boOrderSlipPrinter2) { clsPLUReportDetails.OrderSlipPrinter = OrderSlipPrinter.RetailPlusOSPrinter2; clsPLUReport.Insert(clsPLUReportDetails); } if (boOrderSlipPrinter3) { clsPLUReportDetails.OrderSlipPrinter = OrderSlipPrinter.RetailPlusOSPrinter3; clsPLUReport.Insert(clsPLUReportDetails); } if (boOrderSlipPrinter4) { clsPLUReportDetails.OrderSlipPrinter = OrderSlipPrinter.RetailPlusOSPrinter4; clsPLUReport.Insert(clsPLUReportDetails); } if (boOrderSlipPrinter5) { clsPLUReportDetails.OrderSlipPrinter = OrderSlipPrinter.RetailPlusOSPrinter5; clsPLUReport.Insert(clsPLUReportDetails); } GeneratePLUReport(BranchID, TerminalNo, lProductID, stProductCode, decQuantity); boRetValue = true; } return(boRetValue); } catch (Exception ex) { throw base.ThrowException(ex); } }
// returns True if a composition exist // returns False if a composition does not exist public bool GeneratePLUReport(Int32 BranchID, string TerminalNo, long MainProductID, string MainProductCode, decimal Quantity) { try { bool boRetValue = false; System.Data.DataTable dtCompositionList = ListAsDataTable(MainProductID, "CompositionID", SortOption.Ascending); Data.PLUReport clsPLUReport = new Data.PLUReport(base.Connection, base.Transaction); PLUReportDetails clsPLUReportDetails; foreach(System.Data.DataRow dr in dtCompositionList.Rows) { long lProductID = Convert.ToInt64(dr["ProductID"]); string stProductCode = dr["ProductCode"].ToString(); decimal decQuantity = Convert.ToDecimal(Convert.ToDecimal(dr["Quantity"]) * Quantity); bool boOrderSlipPrinter1 = bool.Parse(dr["OrderSlipPrinter1"].ToString()); bool boOrderSlipPrinter2 = bool.Parse(dr["OrderSlipPrinter2"].ToString()); bool boOrderSlipPrinter3 = bool.Parse(dr["OrderSlipPrinter3"].ToString()); bool boOrderSlipPrinter4 = bool.Parse(dr["OrderSlipPrinter4"].ToString()); bool boOrderSlipPrinter5 = bool.Parse(dr["OrderSlipPrinter5"].ToString()); clsPLUReportDetails = new PLUReportDetails(); clsPLUReportDetails.BranchDetails = new BranchDetails { BranchID = BranchID }; clsPLUReportDetails.TerminalNo = TerminalNo; clsPLUReportDetails.ProductID = lProductID; clsPLUReportDetails.ProductCode = MainProductCode + "-" + stProductCode; clsPLUReportDetails.Quantity = decQuantity; clsPLUReportDetails.Amount = 0; if (boOrderSlipPrinter1) { clsPLUReportDetails.OrderSlipPrinter = OrderSlipPrinter.RetailPlusOSPrinter1; clsPLUReport.Insert(clsPLUReportDetails); } if (boOrderSlipPrinter2) { clsPLUReportDetails.OrderSlipPrinter = OrderSlipPrinter.RetailPlusOSPrinter2; clsPLUReport.Insert(clsPLUReportDetails); } if (boOrderSlipPrinter3) { clsPLUReportDetails.OrderSlipPrinter = OrderSlipPrinter.RetailPlusOSPrinter3; clsPLUReport.Insert(clsPLUReportDetails); } if (boOrderSlipPrinter4) { clsPLUReportDetails.OrderSlipPrinter = OrderSlipPrinter.RetailPlusOSPrinter4; clsPLUReport.Insert(clsPLUReportDetails); } if (boOrderSlipPrinter5) { clsPLUReportDetails.OrderSlipPrinter = OrderSlipPrinter.RetailPlusOSPrinter5; clsPLUReport.Insert(clsPLUReportDetails); } GeneratePLUReport(BranchID, TerminalNo, lProductID, stProductCode, decQuantity); boRetValue = true; } return boRetValue; } catch (Exception ex) { throw base.ThrowException(ex); } }