Beispiel #1
0
        // 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);
            }
        }
Beispiel #2
0
        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);
			}	
		}