Exemple #1
0
		private void LoadItems()
		{
			DataClass clsDataClass = new DataClass();

			WBranchTransferItem clsWBranchTransferItem = new WBranchTransferItem();
            lstItem.DataSource = clsWBranchTransferItem.ListAsDataTable(Convert.ToInt64(lblWBranchTransferID.Text)).DefaultView;
			lstItem.DataBind();
			clsWBranchTransferItem.CommitAndDispose();
		}
Exemple #2
0
        private void LoadItem(string stID)
        {
            WBranchTransferItem clsWBranchTransferItem = new WBranchTransferItem();
            WBranchTransferItemDetails clsWBranchTransferItemDetails = clsWBranchTransferItem.Details(Convert.ToInt64(stID));
            clsWBranchTransferItem.CommitAndDispose();

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

            txtProductCode.Text = clsWBranchTransferItemDetails.BarCode;
            cmdProductCode_Click(null, null);

            cboProductCode.SelectedIndex = cboProductCode.Items.IndexOf(new ListItem(clsWBranchTransferItemDetails.ProductCode, clsWBranchTransferItemDetails.ProductID.ToString()));

            if (clsWBranchTransferItemDetails.VariationMatrixID == 0)
            { cboVariation.Items.Add(new ListItem("No Variation", "0")); cboVariation.SelectedIndex = 0; }
            else
            { cboVariation.SelectedIndex = cboVariation.Items.IndexOf(new ListItem(clsWBranchTransferItemDetails.MatrixDescription, clsWBranchTransferItemDetails.VariationMatrixID.ToString())); }

            if (clsWBranchTransferItemDetails.ProductUnitID == 0)
            { cboProductUnit.Items.Add(new ListItem("No Unit", "0")); cboProductUnit.SelectedIndex = 0; }
            else
            { cboProductUnit.SelectedIndex = cboProductUnit.Items.IndexOf(new ListItem(clsWBranchTransferItemDetails.ProductUnitCode, clsWBranchTransferItemDetails.ProductUnitID.ToString()));}

            txtQuantity.Text = clsWBranchTransferItemDetails.Quantity.ToString("###0.#0");
            txtPrice.Text = clsWBranchTransferItemDetails.UnitCost.ToString("###0.#0");
            txtDiscount.Text = clsWBranchTransferItemDetails.Discount.ToString("###0.#0");

            if (clsWBranchTransferItemDetails.DiscountType == DiscountTypes.Percentage)
                chkInPercent.Checked = true;
            else
            {
                chkInPercent.Checked = false;
            }
            txtAmount.Text = clsWBranchTransferItemDetails.Amount.ToString("###0.#0");
            txtRemarks.Text = clsWBranchTransferItemDetails.Remarks;
            lblWBranchTransferItemID.Text = stID;
            chkIsTaxable.Checked = clsWBranchTransferItemDetails.IsVatable;

            //Added Jan 1, 2010 4:20PM : For selling information
            txtSellingQuantity.Text = "1";
            txtMargin.Text = decimal.Parse(Convert.ToString(((clsWBranchTransferItemDetails.SellingPrice - clsWBranchTransferItemDetails.UnitCost) / clsWBranchTransferItemDetails.UnitCost) * 100)).ToString("###0.#0");
            txtSellingPrice.Text = clsWBranchTransferItemDetails.SellingPrice.ToString("###0.#0");
            txtVAT.Text = clsWBranchTransferItemDetails.SellingVAT.ToString("###0.#0");
            txtEVAT.Text = clsWBranchTransferItemDetails.SellingEVAT.ToString("###0.#0");
            txtLocalTax.Text = clsWBranchTransferItemDetails.SellingLocalTax.ToString("###0.#0");
            txtOldSellingPrice.Text = clsWBranchTransferItemDetails.OldSellingPrice.ToString("###0.#0");

            txtProductCode.Focus();
            ShowCommandButtons(true);
        }
Exemple #3
0
		private void SaveRecord()
		{
			WBranchTransferItemDetails clsDetails = new WBranchTransferItemDetails();

			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.WBranchTransferID = Convert.ToInt64(lblWBranchTransferID.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);
            }
            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;
            
            clsDetails.SellingPrice = decimal.Parse(txtSellingPrice.Text);
            clsDetails.SellingVAT = decimal.Parse(txtVAT.Text);
            clsDetails.SellingEVAT = decimal.Parse(txtEVAT.Text);
            clsDetails.SellingLocalTax = decimal.Parse(txtLocalTax.Text);
            clsDetails.OldSellingPrice = decimal.Parse(txtOldSellingPrice.Text);

            WBranchTransferItem clsWBranchTransferItem = new WBranchTransferItem();
            if (lblWBranchTransferItemID.Text != "0")
            {
                clsDetails.WBranchTransferItemID = Convert.ToInt64(lblWBranchTransferItemID.Text);
                clsWBranchTransferItem.Update(clsDetails);
            }
            else
                clsWBranchTransferItem.Insert(clsDetails);

            WBranchTransferDetails clsWBranchTransferDetails = new WBranchTransferDetails();
            clsWBranchTransferDetails.WBranchTransferID = clsDetails.WBranchTransferID;
            clsWBranchTransferDetails.DiscountApplied = Convert.ToDecimal(txtWBranchTransferDiscountApplied.Text);
            clsWBranchTransferDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboWBranchTransferDiscountType.SelectedItem.Value);

            WBranchTransfer clsWBranchTransfer = new WBranchTransfer(clsWBranchTransferItem.Connection, clsWBranchTransferItem.Transaction);
            clsWBranchTransfer.UpdateDiscount(clsDetails.WBranchTransferID, clsWBranchTransferDetails.DiscountApplied, clsWBranchTransferDetails.DiscountType);
            
            clsWBranchTransferDetails = clsWBranchTransfer.Details(clsDetails.WBranchTransferID);
            clsWBranchTransferItem.CommitAndDispose();

            UpdateFooter(clsWBranchTransferDetails);
		}
Exemple #4
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)
			{
				WBranchTransferItem clsWBranchTransferItem = new WBranchTransferItem();
				clsWBranchTransferItem.Delete( stIDs.Substring(0,stIDs.Length-1));

				WBranchTransfer clsWBranchTransfer = new WBranchTransfer(clsWBranchTransferItem.Connection, clsWBranchTransferItem.Transaction);
				clsWBranchTransfer.SynchronizeAmount(Convert.ToInt64(lblWBranchTransferID.Text));

				WBranchTransferDetails clsWBranchTransferDetails = clsWBranchTransfer.Details(Convert.ToInt64(lblWBranchTransferID.Text));

				clsWBranchTransferItem.CommitAndDispose();

                UpdateFooter(clsWBranchTransferDetails);
			}

			return boRetValue;
		}
Exemple #5
0
		private void LoadItems()
		{
			WBranchTransferItem clsWBranchTransferItem = new WBranchTransferItem();
			lstItem.DataSource = clsWBranchTransferItem.ListAsDataTable(Convert.ToInt64(lblWBranchTransferID.Text), "WBranchTransferItemID",SortOption.Ascending).DefaultView;
			lstItem.DataBind();
			clsWBranchTransferItem.CommitAndDispose();
		}