Exemple #1
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);
			}	
		}
Exemple #2
0
		private void LoadItems()
		{
			DataClass clsDataClass = new DataClass();

			ProductComposition clsProductComposition = new ProductComposition();
			lstItem.DataSource = clsProductComposition.ListAsDataTable(Convert.ToInt64(lblProductID.Text), "CompositionID",SortOption.Ascending).DefaultView;
			lstItem.DataBind();
			clsProductComposition.CommitAndDispose();
		}
Exemple #3
0
		private bool DeleteItems()
		{
			bool boRetValue = false;
			string stIDs = "";

			foreach(DataListItem item in lstItem.Items)
			{
				HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList");
				if (chkList!=null)
				{
					if (chkList.Checked == true)
					{
						stIDs += chkList.Value + ",";		
						boRetValue = true;
					}
				}
			}
			if (boRetValue)
			{
				ProductComposition clsProductComposition = new ProductComposition();
				clsProductComposition.Delete( stIDs.Substring(0,stIDs.Length-1));

				clsProductComposition.CommitAndDispose();
			}

			return boRetValue;
		}
Exemple #4
0
		private void UpdateItem()
		{
			if (isChkListSingle() == true)
			{
				string stID = GetFirstID();
				if (stID!=null)
				{
					ProductComposition clsProductComposition = new ProductComposition();
					ProductCompositionDetails clsDetails = clsProductComposition.Details(Convert.ToInt64(stID));
					clsProductComposition.CommitAndDispose();

					cboProductCode.Items.Clear();
					cboVariation.Items.Clear();
					cboProductUnit.Items.Clear();

					cboProductCode.Items.Add(new ListItem(clsDetails.ProductCode, clsDetails.ProductID.ToString()));
					cboProductCode.SelectedIndex = 0;
					if (clsDetails.VariationMatrixID == 0)
					{	cboVariation.Items.Add(new ListItem("No Variation", "0"));	}
					else
					{	cboVariation.Items.Add(new ListItem(clsDetails.MatrixDescription, clsDetails.VariationMatrixID.ToString()));	}
					cboVariation.SelectedIndex = 0;
					cboProductUnit.Items.Add(new ListItem(clsDetails.UnitCode, clsDetails.UnitID.ToString()));
					cboProductUnit.SelectedIndex = 0;
					txtQuantity.Text = clsDetails.Quantity.ToString("###0.#0");
					lblCompositionID.Text = stID;
				}
			}
			else
			{
				string stScript = "<Script>";
				stScript += "window.alert('Cannot update more than one record. Please select at least one record to update.')";
				stScript += "</Script>";
				Response.Write(stScript);	
			}
		}
Exemple #5
0
		private void SaveRecord()
		{
			ProductCompositionDetails clsDetails = new ProductCompositionDetails();

			clsDetails.MainProductID = Convert.ToInt64(lblProductID.Text);
			clsDetails.ProductID = Convert.ToInt64(cboProductCode.SelectedItem.Value);
			clsDetails.VariationMatrixID = Convert.ToInt64(cboVariation.SelectedItem.Value);
			clsDetails.Quantity = Convert.ToDecimal(txtQuantity.Text);
			clsDetails.UnitID = Convert.ToInt32(cboProductUnit.SelectedItem.Value);

			ProductComposition clsProductComposition = new ProductComposition();
			if (lblCompositionID.Text != "0")
			{
				clsDetails.CompositionID = Convert.ToInt64(lblCompositionID.Text);
				clsProductComposition.Update(clsDetails);
			}
			else
				clsProductComposition.Insert(clsDetails);
			
			clsProductComposition.CommitAndDispose();

		}