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

			DebitMemoItems clsDebitMemoItems = new DebitMemoItems();
			lstItem.DataSource = clsDebitMemoItems.ListAsDataTable(Convert.ToInt64(lblDebitMemoID.Text)).DefaultView;
			lstItem.DataBind();
			clsDebitMemoItems.CommitAndDispose();
		}
Example #2
0
        private void LoadItem(string stID)
        {
            DebitMemoItems clsDebitMemoItems = new DebitMemoItems();
            DebitMemoItemDetails clsDebitMemoItemDetails = clsDebitMemoItems.Details(Convert.ToInt64(stID));
            clsDebitMemoItems.CommitAndDispose();

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

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

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

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

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

            txtQuantity.Text = clsDebitMemoItemDetails.Quantity.ToString("###0.##0");
            txtPrice.Text = clsDebitMemoItemDetails.UnitCost.ToString("###0.##0");
            txtDiscount.Text = clsDebitMemoItemDetails.DiscountApplied.ToString("###0.##0");

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

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

            ////Added April 28, 2010 4:20PM : For selling information
            //txtOldSellingPrice.Text = clsDebitMemoItemDetails.OldSellingPrice.ToString("###0.##0");

            //// Aug 9, 2011 : Lemu
            //// For Required Inventory Days
            //txtRID.Text = clsDebitMemoItemDetails.RID.ToString();

            txtProductCode.Focus();
            ShowCommandButtons(true);
        }
Example #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)
			{
				DebitMemoItems clsDebitMemoItems = new DebitMemoItems();
				clsDebitMemoItems.Delete( stIDs.Substring(0,stIDs.Length-1));

				DebitMemos clsDebitMemos = new DebitMemos(clsDebitMemoItems.Connection, clsDebitMemoItems.Transaction);
				clsDebitMemos.SynchronizeAmount(Convert.ToInt64(lblDebitMemoID.Text));

				DebitMemoDetails clsDebitMemoDetails = clsDebitMemos.Details(Convert.ToInt64(lblDebitMemoID.Text));

				clsDebitMemoItems.CommitAndDispose();

                UpdateFooter(clsDebitMemoDetails);
			}

			return boRetValue;
		}
Example #4
0
        private void UpdateItem()
		{
			if (isChkListSingle() == true)
			{
				string stID = GetFirstID();
				if (stID!=null)
				{
					DebitMemoItems clsDebitMemoItems = new DebitMemoItems();
                    DebitMemoItemDetails clsDebitMemoItemDetails = clsDebitMemoItems.Details(Convert.ToInt64(stID));
					clsDebitMemoItems.CommitAndDispose();

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

                    cboProductCode.Items.Add(new ListItem(clsDebitMemoItemDetails.ProductCode, clsDebitMemoItemDetails.ProductID.ToString()));
                    cboProductCode.SelectedIndex = 0;
                    if (clsDebitMemoItemDetails.VariationMatrixID == 0)
                    { cboVariation.Items.Add(new ListItem("No Variation", "0")); }
                    else
                    { cboVariation.Items.Add(new ListItem(clsDebitMemoItemDetails.MatrixDescription, clsDebitMemoItemDetails.VariationMatrixID.ToString())); }
                    cboVariation.SelectedIndex = 0;
                    cboProductUnit.Items.Add(new ListItem(clsDebitMemoItemDetails.ProductUnitCode, clsDebitMemoItemDetails.ProductUnitID.ToString()));
                    cboProductUnit.SelectedIndex = 0;
                    txtQuantity.Text = clsDebitMemoItemDetails.Quantity.ToString("###0.#0");
                    txtPrevPrice.Text = clsDebitMemoItemDetails.PrevUnitCost.ToString("###0.#0");
                    txtPrice.Text = clsDebitMemoItemDetails.UnitCost.ToString("###0.#0");
                    txtDiscount.Text = clsDebitMemoItemDetails.Discount.ToString("###0.#0");
                    if (clsDebitMemoItemDetails.DiscountType == DiscountTypes.Percentage)
                        chkInPercent.Checked = true;
                    else
                    {
                        chkInPercent.Checked = false;
                    }
                    txtAmount.Text = clsDebitMemoItemDetails.Amount.ToString("###0.#0");
                    txtRemarks.Text = clsDebitMemoItemDetails.Remarks;
                    lblDebitMemoItemID.Text = stID;
                    chkIsTaxable.Checked = clsDebitMemoItemDetails.IsVatable;
				}
			}
			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);	
			}
		}
Example #5
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);
		}