Пример #1
0
		private void SaveRecord()
		{
			DebitMemoItemDetails clsDetails = new DebitMemoItemDetails();

			Products clsProducts = new Products();
            ProductDetails clsProductDetails = clsProducts.Details1(Constants.BRANCH_ID_MAIN, Convert.ToInt64(cboProductCode.SelectedItem.Value));
			
			Terminal clsTerminal = new Terminal(clsProducts.Connection, clsProducts.Transaction);
            TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString());
			clsProducts.CommitAndDispose();

            clsDetails.DebitMemoID = Convert.ToInt64(lblDebitMemoID.Text);
            clsDetails.ProductID = Convert.ToInt64(cboProductCode.SelectedItem.Value);
            clsDetails.ProductCode = clsProductDetails.ProductCode;
            clsDetails.BarCode = clsProductDetails.BarCode;
            clsDetails.Description = clsProductDetails.ProductDesc;
            clsDetails.ProductUnitID = Convert.ToInt32(cboProductUnit.SelectedItem.Value);
            clsDetails.ProductUnitCode = cboProductUnit.SelectedItem.Text;
            clsDetails.Quantity = Convert.ToDecimal(txtQuantity.Text);
            clsDetails.PrevUnitCost = Convert.ToDecimal(txtPrevPrice.Text);
            clsDetails.UnitCost = Convert.ToDecimal(txtPrice.Text);
            clsDetails.Discount = getItemTotalDiscount();
            clsDetails.DiscountApplied = Convert.ToDecimal(txtDiscount.Text);
            if (clsDetails.DiscountApplied == 0)
            {
                if (chkInPercent.Checked == true)
                    clsDetails.DiscountType = DiscountTypes.Percentage;
                else
                    clsDetails.DiscountType = DiscountTypes.FixedValue;
            }
            else
            {
                clsDetails.DiscountType = DiscountTypes.NotApplicable;
            }

            clsDetails.IsVatable = chkIsTaxable.Checked;
            clsDetails.Amount = ComputeItemAmount();

            if (clsDetails.IsVatable)
            {
                clsDetails.VatableAmount = clsDetails.Amount;
                clsDetails.EVatableAmount = clsDetails.Amount;
                clsDetails.LocalTax = clsDetails.Amount;

                if (clsTerminalDetails.IsVATInclusive == false)
                {
                    if (clsDetails.VatableAmount < clsDetails.Discount) clsDetails.VatableAmount = 0;
                    if (clsDetails.EVatableAmount < clsDetails.Discount) clsDetails.EVatableAmount = 0;
                    if (clsDetails.LocalTax < clsDetails.Discount) clsDetails.LocalTax = 0;
                }
                else
                {
                    if (clsDetails.VatableAmount >= clsDetails.Discount) clsDetails.VatableAmount = (clsDetails.VatableAmount) / (1 + (clsTerminalDetails.VAT / 100)); else clsDetails.VatableAmount = 0;
                    if (clsDetails.EVatableAmount >= clsDetails.Discount) clsDetails.EVatableAmount = (clsDetails.EVatableAmount) / (1 + (clsTerminalDetails.VAT / 100)); else clsDetails.EVatableAmount = 0;
                    if (clsDetails.LocalTax >= clsDetails.Discount) clsDetails.LocalTax = (clsDetails.LocalTax) / (1 + (clsTerminalDetails.LocalTax / 100)); else clsDetails.LocalTax = 0;
                }

                clsDetails.VAT = clsDetails.VatableAmount * (clsTerminalDetails.VAT / 100);
                clsDetails.EVAT = clsDetails.EVatableAmount * (clsTerminalDetails.EVAT / 100);
                clsDetails.LocalTax = clsDetails.LocalTax * (clsTerminalDetails.LocalTax / 100);
            }
            else
            {
                clsDetails.VAT = 0;
                clsDetails.VatableAmount = 0;
                clsDetails.EVAT = 0;
                clsDetails.EVatableAmount = 0;
                clsDetails.LocalTax = 0;
            }

            clsDetails.isVATInclusive = clsTerminalDetails.IsVATInclusive;
            clsDetails.VariationMatrixID = Convert.ToInt64(cboVariation.SelectedItem.Value);
            if (clsDetails.VariationMatrixID != 0)
                clsDetails.MatrixDescription = cboVariation.SelectedItem.Text;
            clsDetails.ProductGroup = clsProductDetails.ProductGroupCode;
            clsDetails.ProductSubGroup = clsProductDetails.ProductSubGroupCode;
            clsDetails.Remarks = txtRemarks.Text;

			DebitMemoItems clsDebitMemoItems = new DebitMemoItems();
			if (lblDebitMemoItemID.Text != "0")
			{
				clsDetails.DebitMemoItemID = Convert.ToInt64(lblDebitMemoItemID.Text);
				clsDebitMemoItems.Update(clsDetails);
			}
			else
				clsDebitMemoItems.Insert(clsDetails);

            DebitMemoDetails clsDebitMemoDetails = new DebitMemoDetails();
            clsDebitMemoDetails.DebitMemoID = clsDetails.DebitMemoID;
            clsDebitMemoDetails.DiscountApplied = Convert.ToDecimal(txtPODebitMemoDiscountApplied.Text);
            clsDebitMemoDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboPODebitMemoDiscountType.SelectedItem.Value);

            clsDebitMemoDetails.Discount2Applied = Convert.ToDecimal(txtPODebitMemoDiscount2Applied.Text);
            clsDebitMemoDetails.Discount2Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboPODebitMemoDiscount2Type.SelectedItem.Value);

            clsDebitMemoDetails.Discount3Applied = Convert.ToDecimal(txtPODebitMemoDiscount3Applied.Text);
            clsDebitMemoDetails.Discount3Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboPODebitMemoDiscount3Type.SelectedItem.Value);

            DebitMemos clsDebitMemos = new DebitMemos(clsDebitMemoItems.Connection, clsDebitMemoItems.Transaction);
            clsDebitMemos.UpdateDiscount(clsDetails.DebitMemoID, clsDebitMemoDetails.DiscountApplied, clsDebitMemoDetails.DiscountType, clsDebitMemoDetails.Discount2Applied, clsDebitMemoDetails.Discount2Type, clsDebitMemoDetails.Discount3Applied, clsDebitMemoDetails.Discount3Type);

            clsDebitMemoDetails = clsDebitMemos.Details(clsDetails.DebitMemoID);
            clsDebitMemoItems.CommitAndDispose();

            UpdateFooter(clsDebitMemoDetails);
		}
Пример #2
0
		private void LoadOptions()
		{
            Data.Unit clsUnit = new Data.Unit();
			
			cboProductGroupUnit.DataTextField = "UnitName";
			cboProductGroupUnit.DataValueField = "UnitID";
			cboProductGroupUnit.DataSource = clsUnit.ListAsDataTable(SortField: "UnitName").DefaultView;
			cboProductGroupUnit.DataBind();
			cboProductGroupUnit.SelectedIndex = cboProductGroupUnit.Items.Count - 1;

            Terminal clsTerminal = new Terminal(clsUnit.Connection, clsUnit.Transaction);
            TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString());
            txtVAT.Text = clsTerminalDetails.VAT.ToString("###.#0");
            txtEVAT.Text = clsTerminalDetails.EVAT.ToString("###.#0");
            txtLocalTax.Text = clsTerminalDetails.LocalTax.ToString("###.#0");

			clsUnit.CommitAndDispose();
		}
Пример #3
0
		private Int32 SaveRecord()
		{
			ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix();
			ProductUnitsMatrixDetails clsDetails = new ProductUnitsMatrixDetails();

			clsDetails.ProductID = Convert.ToInt64(lblProductID.Text);
			clsDetails.BaseUnitID = Convert.ToInt32(lblBaseUnitID.Text);
			clsDetails.BaseUnitValue = Convert.ToDecimal(txtBaseUnitValue.Text);
			clsDetails.BottomUnitID = Convert.ToInt32(cboBottomUnit.SelectedItem.Value);
			clsDetails.BottomUnitValue = Convert.ToDecimal(txtBottomUnitValue.Text);
			int id = clsUnitMatrix.Insert(clsDetails);

            ProductPackageDetails clsProductPackageDetails = new ProductPackageDetails();
            ProductPackage clsProductPackage = new ProductPackage(clsUnitMatrix.Connection, clsUnitMatrix.Transaction);
            clsProductPackageDetails = clsProductPackage.DetailsByProductIDAndUnitID(Convert.ToInt64(lblProductID.Text), Convert.ToInt32(cboBottomUnit.SelectedItem.Value));
            if (clsProductPackageDetails.PackageID == 0)
            {
                Products clsProduct = new Products(clsUnitMatrix.Connection, clsUnitMatrix.Transaction);
                ProductDetails clsProductDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));

                Terminal clsTerminal = new Terminal(clsUnitMatrix.Connection, clsUnitMatrix.Transaction);
                TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString());

                clsProductPackageDetails.ProductID = Convert.ToInt64(lblProductID.Text);
                clsProductPackageDetails.UnitID = Convert.ToInt32(cboBottomUnit.SelectedItem.Value);
                clsProductPackageDetails.Price = clsProductDetails.Price * Convert.ToDecimal(txtBaseUnitValue.Text);
                clsProductPackageDetails.WSPrice = clsProductDetails.WSPrice * Convert.ToDecimal(txtBaseUnitValue.Text);
                clsProductPackageDetails.PurchasePrice = clsProductDetails.PurchasePrice * Convert.ToDecimal(txtBaseUnitValue.Text);
                clsProductPackageDetails.Quantity = 1;
                clsProductPackageDetails.VAT = clsTerminalDetails.VAT;
                clsProductPackageDetails.EVAT = clsTerminalDetails.EVAT;
                clsProductPackageDetails.LocalTax = clsTerminalDetails.LocalTax;
                if (!string.IsNullOrEmpty(clsProductDetails.BarCode1)) clsProductPackageDetails.BarCode1 = clsProductDetails.BarCode1 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString();
                if (!string.IsNullOrEmpty(clsProductDetails.BarCode2)) clsProductPackageDetails.BarCode2 = clsProductDetails.BarCode2 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString();
                if (!string.IsNullOrEmpty(clsProductDetails.BarCode3)) clsProductPackageDetails.BarCode3 = clsProductDetails.BarCode3 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString();
                clsProductPackage.Insert(clsProductPackageDetails);
            }
			clsUnitMatrix.CommitAndDispose();

			return id;
		}
Пример #4
0
        private void SaveRecord()
        {
            SOItemDetails clsDetails = new SOItemDetails();

            Products clsProducts = new Products();
            ProductDetails clsProductDetails = clsProducts.Details1(Constants.BRANCH_ID_MAIN, Convert.ToInt64(cboProductCode.SelectedItem.Value));

            Terminal clsTerminal = new Terminal(clsProducts.Connection, clsProducts.Transaction);
            TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString());
            clsProducts.CommitAndDispose();

            clsDetails.SOID = Convert.ToInt64(lblSOID.Text);
            clsDetails.ProductID = Convert.ToInt64(cboProductCode.SelectedItem.Value);
            clsDetails.ProductCode = clsProductDetails.ProductCode;
            clsDetails.BarCode = clsProductDetails.BarCode;
            clsDetails.Description = clsProductDetails.ProductDesc;
            clsDetails.ProductUnitID = Convert.ToInt32(cboProductUnit.SelectedItem.Value);
            clsDetails.ProductUnitCode = cboProductUnit.SelectedItem.Text;
            clsDetails.Quantity = Convert.ToDecimal(txtQuantity.Text);
            clsDetails.UnitCost = Convert.ToDecimal(txtPrice.Text);
            clsDetails.Discount = getItemTotalDiscount();
            clsDetails.DiscountApplied = Convert.ToDecimal(txtDiscount.Text);
            if (clsDetails.DiscountApplied == 0)
            {
                if (chkInPercent.Checked == true)
                    clsDetails.DiscountType = DiscountTypes.Percentage;
                else
                    clsDetails.DiscountType = DiscountTypes.FixedValue;
            }
            else
            {
                clsDetails.DiscountType = DiscountTypes.NotApplicable;
            }

            clsDetails.IsVatable = chkIsTaxable.Checked;
            clsDetails.Amount = ComputeItemAmount();

            if (clsDetails.IsVatable)
            {
                clsDetails.VatableAmount = clsDetails.Amount;
                clsDetails.EVatableAmount = clsDetails.Amount;
                clsDetails.LocalTax = clsDetails.Amount;

                if (clsTerminalDetails.IsVATInclusive == false)
                {
                    if (clsDetails.VatableAmount < clsDetails.Discount) clsDetails.VatableAmount = 0;
                    if (clsDetails.EVatableAmount < clsDetails.Discount) clsDetails.EVatableAmount = 0;
                    if (clsDetails.LocalTax < clsDetails.Discount) clsDetails.LocalTax = 0;
                }
                else
                {
                    if (clsDetails.VatableAmount >= clsDetails.Discount) clsDetails.VatableAmount = (clsDetails.VatableAmount) / (1 + (clsTerminalDetails.VAT / 100)); else clsDetails.VatableAmount = 0;
                    if (clsDetails.EVatableAmount >= clsDetails.Discount) clsDetails.EVatableAmount = (clsDetails.EVatableAmount) / (1 + (clsTerminalDetails.VAT / 100)); else clsDetails.EVatableAmount = 0;
                    if (clsDetails.LocalTax >= clsDetails.Discount) clsDetails.LocalTax = (clsDetails.LocalTax) / (1 + (clsTerminalDetails.LocalTax / 100)); else clsDetails.LocalTax = 0;
                }

                clsDetails.VAT = clsDetails.VatableAmount * (clsTerminalDetails.VAT / 100);
                clsDetails.EVAT = clsDetails.EVatableAmount * (clsTerminalDetails.EVAT / 100);
                clsDetails.LocalTax = clsDetails.LocalTax * (clsTerminalDetails.LocalTax / 100);

                //if (!clsTerminalDetails.IsVATInclusive) clsDetails.Amount += (clsDetails.VAT + clsDetails.LocalTax);
                //if (!clsTerminalDetails.EnableEVAT) clsDetails.Amount += clsDetails.EVAT;
            }
            else
            {
                clsDetails.VAT = 0;
                clsDetails.VatableAmount = 0;
                clsDetails.EVAT = 0;
                clsDetails.EVatableAmount = 0;
                clsDetails.LocalTax = 0;
            }

            clsDetails.isVATInclusive = clsTerminalDetails.IsVATInclusive;
            clsDetails.VariationMatrixID = Convert.ToInt64(cboVariation.SelectedItem.Value);
            if (clsDetails.VariationMatrixID != 0)
                clsDetails.MatrixDescription = cboVariation.SelectedItem.Text;
            clsDetails.ProductGroup = clsProductDetails.ProductGroupCode;
            clsDetails.ProductSubGroup = clsProductDetails.ProductSubGroupCode;
            clsDetails.Remarks = txtRemarks.Text;

            // Added Jul 1, 2010 4:20PM : for suggested selling information
            clsDetails.SellingPrice = decimal.Parse(txtSellingPrice.Text);
            clsDetails.SellingVAT = decimal.Parse(txtVAT.Text);
            clsDetails.SellingEVAT = decimal.Parse(txtEVAT.Text);
            clsDetails.SellingLocalTax = decimal.Parse(txtLocalTax.Text);

            SOItem clsSOItem = new SOItem();
            if (lblSOItemID.Text != "0")
            {
                clsDetails.SOItemID = Convert.ToInt64(lblSOItemID.Text);
                clsSOItem.Update(clsDetails);
            }
            else
                clsSOItem.Insert(clsDetails);

            SODetails clsSODetails = new SODetails();
            clsSODetails.SOID = clsDetails.SOID;
            clsSODetails.DiscountApplied = Convert.ToDecimal(txtSODiscountApplied.Text);
            clsSODetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboSODiscountType.SelectedItem.Value);

            SO clsSO = new SO(clsSOItem.Connection, clsSOItem.Transaction);
            clsSO.UpdateDiscount(clsDetails.SOID, clsSODetails.DiscountApplied, clsSODetails.DiscountType);

            clsSODetails = clsSO.Details(clsDetails.SOID);
            clsSOItem.CommitAndDispose();

            UpdateFooter(clsSODetails);
        }
Пример #5
0
		public void GenerateItemsForReorder(Int32 TerminalID, long SOID)
		{
			try
			{
				GetConnection();

				Terminal clsTerminal = new Terminal(base.Connection, base.Transaction);
                TerminalDetails clsTerminalDetails = clsTerminal.Details(TerminalID);

				SODetails clsSODetails = Details(SOID);

				Products clsProduct = new Products(base.Connection, base.Transaction);
				System.Data.DataTable dt = clsProduct.ForReorder(clsSODetails.CustomerID);

				SOItem clsSOItem = new SOItem(base.Connection, base.Transaction);
				ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(base.Connection, base.Transaction);

				foreach (System.Data.DataRow dr in dt.Rows)
				{
					SOItemDetails clsDetails = new SOItemDetails();

					clsDetails.SOID = SOID;
					clsDetails.ProductID = Convert.ToInt64(dr["ProductID"]);
					clsDetails.ProductCode = dr["ProductCode"].ToString();
					clsDetails.BarCode = dr["BarCode"].ToString();
					clsDetails.Description = dr["ProductDesc"].ToString();
					clsDetails.ProductGroup = dr["ProductGroupCode"].ToString();
					clsDetails.ProductSubGroup = dr["ProductSubGroupCode"].ToString();
					clsDetails.ProductUnitID = Convert.ToInt32(dr["UnitID"]);
					clsDetails.ProductUnitCode = dr["UnitName"].ToString();
					clsDetails.Quantity = Convert.ToDecimal(dr["ReorderQty"]);
					clsDetails.UnitCost = Convert.ToDecimal(dr["Price"]);
					clsDetails.Discount = 0;
					clsDetails.DiscountApplied = 0;
					clsDetails.DiscountType = DiscountTypes.Percentage;
					clsDetails.Remarks = "added using auto generation";

					decimal amount = clsDetails.Quantity * clsDetails.UnitCost;

					if (Convert.ToDecimal(dr["VAT"]) > 0)
					{
						clsDetails.VatableAmount = amount;
						clsDetails.EVatableAmount = amount;
						clsDetails.LocalTax = amount;

						clsDetails.VAT = clsDetails.VatableAmount * (clsTerminalDetails.VAT / 100);
						clsDetails.EVAT = clsDetails.EVatableAmount * (clsTerminalDetails.EVAT / 100);
						clsDetails.LocalTax = clsDetails.LocalTax * (clsTerminalDetails.LocalTax / 100);
						clsDetails.IsVatable = true;
					}
					else
					{
						clsDetails.VAT = 0;
						clsDetails.VatableAmount = 0;
						clsDetails.EVAT = 0;
						clsDetails.EVatableAmount = 0;
						clsDetails.LocalTax = 0;
						clsDetails.IsVatable = false;
					}
					clsDetails.Amount = amount + clsDetails.VAT;

					System.Data.DataTable dtmatrix = clsProductVariationsMatrix.ForReorder(clsDetails.ProductID, clsSODetails.CustomerID);
					if (dtmatrix.Rows.Count > 0)
						foreach (System.Data.DataRow drmatrix in dtmatrix.Rows)
						{
							amount = clsDetails.Quantity * clsDetails.UnitCost;

							clsDetails.ProductUnitID = Convert.ToInt32(drmatrix["UnitID"]);
							clsDetails.ProductUnitCode = drmatrix["UnitName"].ToString();
							clsDetails.Quantity = Convert.ToDecimal(drmatrix["ReorderQty"]);
							clsDetails.UnitCost = Convert.ToDecimal(drmatrix["Price"]);

							if (Convert.ToDecimal(drmatrix["VAT"]) > 0)
							{
								clsDetails.VatableAmount = amount;
								clsDetails.EVatableAmount = amount;
								clsDetails.LocalTax = amount;

								clsDetails.VAT = clsDetails.VatableAmount * (clsTerminalDetails.VAT / 100);
								clsDetails.EVAT = clsDetails.EVatableAmount * (clsTerminalDetails.EVAT / 100);
								clsDetails.LocalTax = clsDetails.LocalTax * (clsTerminalDetails.LocalTax / 100);
								clsDetails.IsVatable = true;
							}
							else
							{
								clsDetails.VAT = 0;
								clsDetails.VatableAmount = 0;
								clsDetails.EVAT = 0;
								clsDetails.EVatableAmount = 0;
								clsDetails.LocalTax = 0;
								clsDetails.IsVatable = false;
							}
							clsDetails.Amount = amount + clsDetails.VAT;

							clsDetails.VariationMatrixID = Convert.ToInt64(drmatrix["MatrixID"]);
							clsDetails.MatrixDescription = drmatrix["VariationDesc"].ToString();
							clsSOItem.Insert(clsDetails);
						}
					else
					{
						clsDetails.VariationMatrixID = 0;
						clsDetails.MatrixDescription = string.Empty;
						clsSOItem.Insert(clsDetails);
					}

				}
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}
		}
Пример #6
0
        public void GenerateItemsForReorderByRID(Int32 TerminalID, long POID, long RID, DateTime IDC_StartDate, DateTime IDC_EndDate)
        {
            try
            {
                GetConnection();

                Terminal clsTerminal = new Terminal(base.Connection, base.Transaction);
                TerminalDetails clsTerminalDetails = clsTerminal.Details(TerminalID);

                PODetails clsPODetails = Details(POID);

                Products clsProduct = new Products(base.Connection, base.Transaction);
                // Aug 26, 2011  :Lemu
                // Insert UpdateProductReorderOverStockPerSupplier to update the MinThreshold & MaxThreshold using RID before getting the for stocking
                clsProduct.UpdateProductReorderOverStockPerSupplier(clsPODetails.SupplierID, RID, IDC_StartDate, IDC_EndDate);
                // end

                POItem clsPOItem = new POItem(base.Connection, base.Transaction);

                ProductInventories clsProductInventories = new ProductInventories(base.Connection, base.Transaction);
                System.Data.DataTable dt = clsProductInventories.ListAsDataTable(BranchID: Constants.BRANCH_ID_MAIN, SupplierID: clsPODetails.SupplierID, ForReorder: 1);

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    if (decimal.Round(Convert.ToDecimal(dr["RIDReorderQty"].ToString())) > 0)
                    {
                        POItemDetails clsDetails = new POItemDetails();

                        clsDetails.POID = POID;
                        clsDetails.ProductID = Convert.ToInt64(dr["ProductID"].ToString());
                        clsDetails.ProductCode = dr["ProductCode"].ToString();
                        clsDetails.BarCode = dr["BarCode"].ToString();
                        clsDetails.Description = dr["ProductDesc"].ToString();
                        clsDetails.ProductGroup = dr["ProductGroupCode"].ToString();
                        clsDetails.ProductSubGroup = dr["ProductSubGroupCode"].ToString();
                        clsDetails.ProductUnitID = Convert.ToInt32(dr["UnitID"]);
                        clsDetails.ProductUnitCode = dr["UnitName"].ToString();
                        clsDetails.RID = Convert.ToInt64(dr["RID"]);
                        clsDetails.Quantity = decimal.Round(Convert.ToDecimal(dr["RIDReorderQty"]));
                        clsDetails.UnitCost = Convert.ToDecimal(dr["PurchasePrice"]);
                        clsDetails.Discount = 0;
                        clsDetails.DiscountApplied = 0;
                        clsDetails.DiscountType = DiscountTypes.Percentage;
                        clsDetails.Remarks = "added using auto generation";

                        decimal amount = clsDetails.Quantity * clsDetails.UnitCost;


                        // Added Sep 27, 2010 4:20PM : for selling information
                        clsDetails.SellingPrice = decimal.Parse(dr["Price"].ToString());
                        clsDetails.SellingVAT = clsTerminalDetails.VAT;
                        clsDetails.SellingEVAT = clsTerminalDetails.EVAT;
                        clsDetails.SellingLocalTax = clsTerminalDetails.LocalTax;
                        clsDetails.OldSellingPrice = clsDetails.SellingPrice;

                        if (Convert.ToDecimal(dr["VAT"]) > 0)
                        {
                            clsDetails.VatableAmount = amount;
                            clsDetails.EVatableAmount = amount;
                            clsDetails.LocalTax = amount;

                            clsDetails.VatableAmount = (clsDetails.VatableAmount) / (1 + (clsTerminalDetails.VAT / 100));
                            clsDetails.EVatableAmount = (clsDetails.EVatableAmount) / (1 + (clsTerminalDetails.VAT / 100));
                            clsDetails.LocalTax = (clsDetails.LocalTax) / (1 + (clsTerminalDetails.LocalTax / 100));
                            clsDetails.IsVatable = true;
                        }
                        else
                        {
                            clsDetails.VAT = 0;
                            clsDetails.VatableAmount = 0;
                            clsDetails.EVAT = 0;
                            clsDetails.EVatableAmount = 0;
                            clsDetails.LocalTax = 0;
                            clsDetails.IsVatable = false;
                        }
                        clsDetails.Amount = amount;

                        clsDetails.VariationMatrixID = Convert.ToInt64(dr["MatrixID"]);
                        clsDetails.MatrixDescription = dr["MatrixDescription"].ToString();
                        clsPOItem.Insert(clsDetails);
                    }
                }
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #7
0
		private void LoadRecord()
		{

			Int32 TerminalID = Convert.ToInt32(Common.Decrypt(Request.QueryString["id"],Session.SessionID));
			Terminal clsTerminal = new Terminal();
            TerminalDetails clsDetails = clsTerminal.Details(TerminalID);
			clsTerminal.CommitAndDispose();

            lblBranchID.Text = clsDetails.BranchID.ToString();
			lblTerminalID.Text = clsDetails.TerminalID.ToString();
			txtTerminalNo.Text = clsDetails.TerminalNo;
			txtTerminalCode.Text = clsDetails.TerminalCode;
			txtTerminalName.Text = clsDetails.TerminalName;
			txtStatus.Text = clsDetails.Status.ToString("G");
			txtDateCreated.Text = clsDetails.DateCreated.ToString("yyyy-MM-dd HH:mm");
			txtMachineSerialNo.Text = clsDetails.MachineSerialNo;
			txtAccreditationNo.Text = clsDetails.AccreditationNo;

			chkIsPrinterAutoCutter.Checked = clsDetails.IsPrinterAutoCutter;
			cboAutoPrint.SelectedIndex = cboAutoPrint.Items.IndexOf(cboAutoPrint.Items.FindByValue(clsDetails.AutoPrint.ToString("d")));
			chkIsVATInclusive.Checked = clsDetails.IsVATInclusive;

			txtPrinterName.Text = clsDetails.PrinterName;
			txtTurretName.Text = clsDetails.TurretName;
			txtCashDrawerName.Text = clsDetails.CashDrawerName;

			chkItemVoidConfirmation.Checked = clsDetails.ItemVoidConfirmation;
			chkEnableEVAT.Checked = clsDetails.EnableEVAT;
			txtMaxReceiptWidth.Text = clsDetails.MaxReceiptWidth.ToString();

			cboFormBehaviour.SelectedIndex = cboFormBehaviour.Items.IndexOf(cboFormBehaviour.Items.FindByValue(clsDetails.FORM_Behavior));

			txtMarqueeMessage.Text = clsDetails.MarqueeMessage;
			
			if (Session["UserName"].ToString().ToLower() == "admin")
			{
				txtMachineSerialNo.ReadOnly = false;
				txtAccreditationNo.ReadOnly = false;
			}

            // Added May 6, 2009.
            txtVAT.Text = clsDetails.VAT.ToString("##.#0");
            txtEVAT.Text = clsDetails.EVAT.ToString("##.#0");
            txtLocalTax.Text = clsDetails.LocalTax.ToString("##.#0");
            chkShowItemMoreThanZeroQty.Checked = clsDetails.ShowItemMoreThanZeroQty;
            chkShowOnlyPackedTransactions.Checked = clsDetails.ShowOnlyPackedTransactions;
            chkShowOneTerminalSuspendedTransactions.Checked = clsDetails.ShowOneTerminalSuspendedTransactions;
            cboReceiptType.SelectedIndex = cboReceiptType.Items.IndexOf(cboReceiptType.Items.FindByValue(clsDetails.ReceiptType.ToString("d")));
            txtSalesInvoicePrinterName.Text = clsDetails.SalesInvoicePrinterName;
            chkCashCountBeforeReport.Checked = clsDetails.CashCountBeforeReport;
            chkPreviewTerminalReport.Checked = clsDetails.PreviewTerminalReport;

            // Added May 6, 2009.
            chkIsPrinterDotmatrix.Checked = clsDetails.IsPrinterDotMatrix;
            chkIsChargeEditable.Checked = clsDetails.IsChargeEditable;
            chkIsDiscountEditable.Checked = clsDetails.IsDiscountEditable;
            chkCheckCutOffTime.Checked = clsDetails.CheckCutOffTime;
            txtStartCutOffTime.Text = clsDetails.StartCutOffTime;
            txtEndCutOffTime.Text = clsDetails.EndCutOffTime;
            chkWithRestaurantFeatures.Checked = clsDetails.WithRestaurantFeatures;
            cboDiscountCode.SelectedIndex = cboDiscountCode.Items.IndexOf(cboDiscountCode.Items.FindByValue(clsDetails.SeniorCitizenDiscountCode));
            cboPWDDiscountCode.SelectedIndex = cboPWDDiscountCode.Items.IndexOf(cboPWDDiscountCode.Items.FindByValue(clsDetails.PWDDiscountCode));
            chkIsTouchScreen.Checked = clsDetails.IsTouchScreen;
            chkWillContinueSelectionVariation.Checked = clsDetails.WillContinueSelectionVariation;
            chkWillContinueSelectionProduct.Checked = clsDetails.WillContinueSelectionProduct;
            chkWillPrintGrandTotal.Checked = clsDetails.WillPrintGrandTotal;
            chkReservedAndCommit.Checked = clsDetails.ReservedAndCommit;

            // Added Oct 17, 2011
            chkShowCustomerSelection.Checked = clsDetails.ShowCustomerSelection;

            cboGroupChargeType.SelectedIndex = cboGroupChargeType.Items.IndexOf(cboGroupChargeType.Items.FindByValue(clsDetails.GroupChargeType.ChargeTypeID.ToString()));
            cboPersonalChargeType.SelectedIndex = cboPersonalChargeType.Items.IndexOf(cboPersonalChargeType.Items.FindByValue(clsDetails.PersonalChargeType.ChargeTypeID.ToString()));

            // Added Sep 24, 2014
            cboDefaultTransactionChargeCode.SelectedIndex = cboDefaultTransactionChargeCode.Items.IndexOf(cboDefaultTransactionChargeCode.Items.FindByValue(clsDetails.DefaultTransactionChargeCode));
            cboDineInChargeCode.SelectedIndex = cboDineInChargeCode.Items.IndexOf(cboDineInChargeCode.Items.FindByValue(clsDetails.DineInChargeCode));
            cboTakeOutChargeCode.SelectedIndex = cboTakeOutChargeCode.Items.IndexOf(cboTakeOutChargeCode.Items.FindByValue(clsDetails.TakeOutChargeCode));
            cboDeliveryChargeCode.SelectedIndex = cboDeliveryChargeCode.Items.IndexOf(cboDeliveryChargeCode.Items.FindByValue(clsDetails.DeliveryChargeCode));
		}
Пример #8
0
		private void LoadOptions()
		{
			ProductGroup clsProductGroup = new ProductGroup();
			DataClass clsDataClass = new DataClass();
			
			cboGroup.DataTextField = "ProductGroupName";
			cboGroup.DataValueField = "ProductGroupID";
			cboGroup.DataSource = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName").DefaultView;
			cboGroup.DataBind();
			cboGroup.SelectedIndex = cboGroup.Items.Count - 1;
			cboGroup_SelectedIndexChanged(null, System.EventArgs.Empty);

            Data.Unit clsUnit = new Data.Unit();
			
			cboProductSubGroupUnit.DataTextField = "UnitName";
			cboProductSubGroupUnit.DataValueField = "UnitID";
			cboProductSubGroupUnit.DataSource = clsUnit.ListAsDataTable(SortField:"UnitName").DefaultView;
			cboProductSubGroupUnit.DataBind();
			cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.Count - 1;

            Terminal clsTerminal = new Terminal(clsUnit.Connection, clsUnit.Transaction);
            TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString());
            txtVAT.Text = clsTerminalDetails.VAT.ToString("###.#0");
            txtEVAT.Text = clsTerminalDetails.EVAT.ToString("###.#0");
            txtLocalTax.Text = clsTerminalDetails.LocalTax.ToString("###.#0");

			clsUnit.CommitAndDispose();

			if (cboGroup.Items.Count != 0)
			{
				Int32 BaseUnitID= clsProductGroup.Details(Convert.ToInt32(cboGroup.SelectedItem.Value)).UnitDetails.UnitID;
				cboProductSubGroupUnit.SelectedIndex = cboProductSubGroupUnit.Items.IndexOf( cboProductSubGroupUnit.Items.FindByValue(BaseUnitID.ToString()));
			}
			clsProductGroup.CommitAndDispose();	
		}
Пример #9
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();
			Int32 iID = Convert.ToInt32(Common.Decrypt(Request.QueryString["id"],Session.SessionID));

			ProductGroup clsProductGroup = new ProductGroup();
			cboProductGroup.DataTextField = "ProductGroupName";
			cboProductGroup.DataValueField = "ProductGroupID";
			cboProductGroup.DataSource = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName").DefaultView;
			cboProductGroup.DataBind();
			cboProductGroup.SelectedIndex = cboProductGroup.Items.Count - 1;

            Data.Unit clsUnit = new Data.Unit(clsProductGroup.Connection, clsProductGroup.Transaction);
			cboProductUnit.DataTextField = "UnitName";
			cboProductUnit.DataValueField = "UnitID";
			cboProductUnit.DataSource = clsUnit.ListAsDataTable(SortField:"UnitName").DefaultView;
			cboProductUnit.DataBind();
			cboProductUnit.SelectedIndex = cboProductUnit.Items.Count - 1;
			clsUnit.CommitAndDispose();

            ContactColumns clsContactColumns = new ContactColumns();
            clsContactColumns.ContactID = true;
            clsContactColumns.ContactName = true;

            ContactColumns clsContactSearchColumns = new ContactColumns();

            Contacts clsContact = new Contacts(clsProductGroup.Connection, clsProductGroup.Transaction);
            cboSupplier.DataTextField = "ContactName";
            cboSupplier.DataValueField = "ContactID";
            cboSupplier.DataSource = clsContact.Suppliers(clsContactColumns, 0, System.Data.SqlClient.SortOrder.Ascending, clsContactSearchColumns, string.Empty, 0, false, "ContactName", System.Data.SqlClient.SortOrder.Ascending).DefaultView;
            cboSupplier.DataBind();
            cboSupplier.SelectedIndex = cboSupplier.Items.Count - 1;

			ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(clsProductGroup.Connection, clsProductGroup.Transaction);
			ProductUnitsMatrixDetails clsUnitDetails = clsUnitMatrix.LastDetails(iID);

			if (clsUnitDetails.BottomUnitName == null)
			{
				cboProductUnit.Enabled = true;
			}

            // Added July 9, 2010
            Terminal clsTerminal = new Terminal(clsProductGroup.Connection, clsProductGroup.Transaction);
            TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString());
            txtWSPriceMarkUp.Text = clsTerminalDetails.WSPriceMarkUp.ToString();
            txtMargin.Text = clsTerminalDetails.RETPriceMarkUp.ToString();

			clsProductGroup.CommitAndDispose();	
		}