Esempio n. 1
0
		private void LoadItems()
		{
			DataClass clsDataClass = new DataClass();

			POItem clsPOItem = new POItem();
			lstItem.DataSource = clsPOItem.ListAsDataTable(Convert.ToInt64(lblPOID.Text)).DefaultView;
			lstItem.DataBind();
			clsPOItem.CommitAndDispose();
		}
Esempio n. 2
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)
			{
				POItem clsPOItem = new POItem();
				clsPOItem.Delete( stIDs.Substring(0,stIDs.Length-1));

				PO clsPO = new PO(clsPOItem.Connection, clsPOItem.Transaction);
				clsPO.SynchronizeAmount(Convert.ToInt64(lblPOID.Text));

				PODetails clsPODetails = clsPO.Details(Convert.ToInt64(lblPOID.Text));

				clsPOItem.CommitAndDispose();

                UpdateFooter(clsPODetails);
			}

			return boRetValue;
		}
Esempio n. 3
0
		private void SaveRecord()
		{
			POItemDetails clsDetails = new POItemDetails();

			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.POID = Convert.ToInt64(lblPOID.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)
            {
                clsDetails.DiscountType = DiscountTypes.NotApplicable;
            }
            else 
            {
                if (chkInPercent.Checked == true)
                    clsDetails.DiscountType = DiscountTypes.Percentage;
                else
                    clsDetails.DiscountType = DiscountTypes.FixedValue;
            }

            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 jan 1, 2010 4:20PM : for 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);
            clsDetails.OldSellingPrice = decimal.Parse(txtOldSellingPrice.Text);

            // Aug 9, 2011 : Lemu
            // For Required Inventory Days
            clsDetails.RID = long.Parse(txtRID.Text);
            
            POItem clsPOItem = new POItem();
            if (lblPOItemID.Text != "0")
            {
                clsDetails.POItemID = Convert.ToInt64(lblPOItemID.Text);
                clsPOItem.Update(clsDetails);
            }
            else
                clsPOItem.Insert(clsDetails);

            PODetails clsPODetails = new PODetails();
            clsPODetails.POID = clsDetails.POID;
            clsPODetails.DiscountApplied = Convert.ToDecimal(txtPODiscountApplied.Text);
            clsPODetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboPODiscountType.SelectedItem.Value);

            clsPODetails.Discount2Applied = Convert.ToDecimal(txtPODiscount2Applied.Text);
            clsPODetails.Discount2Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboPODiscount2Type.SelectedItem.Value);

            clsPODetails.Discount3Applied = Convert.ToDecimal(txtPODiscount3Applied.Text);
            clsPODetails.Discount3Type = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboPODiscount3Type.SelectedItem.Value);

            PO clsPO = new PO(clsPOItem.Connection, clsPOItem.Transaction);
            clsPO.UpdateDiscount(clsDetails.POID, clsPODetails.DiscountApplied, clsPODetails.DiscountType, clsPODetails.Discount2Applied, clsPODetails.Discount2Type, clsPODetails.Discount3Applied, clsPODetails.Discount3Type);
            
            clsPODetails = clsPO.Details(clsDetails.POID);
            clsPOItem.CommitAndDispose();

            UpdateFooter(clsPODetails);
		}
Esempio n. 4
0
        private void UpdateItemReceiveStatus(long POItemID, POItemReceivedStatus clsPOItemReceivedStatus, decimal ReceivedQuantity)
        {

            POItem clsPOItem = new POItem();
            clsPOItem.UpdateReceiveStatus(POItemID, clsPOItemReceivedStatus, ReceivedQuantity);
            clsPOItem.CommitAndDispose();

        }
Esempio n. 5
0
        private void LoadItem(string stID)
        {
            POItem clsPOItem = new POItem();
            POItemDetails clsPOItemDetails = clsPOItem.Details(Convert.ToInt64(stID));
            clsPOItem.CommitAndDispose();

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

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

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

            if (clsPOItemDetails.VariationMatrixID == 0)
            { cboVariation.Items.Add(new ListItem("No Variation", "0")); cboVariation.SelectedIndex = 0; }
            else
            { cboVariation.SelectedIndex = cboVariation.Items.IndexOf(new ListItem(clsPOItemDetails.MatrixDescription, clsPOItemDetails.VariationMatrixID.ToString()));}
            
            if (clsPOItemDetails.ProductUnitID == 0)
            { cboProductUnit.Items.Add(new ListItem("No Unit", "0")); cboProductUnit.SelectedIndex = 0; }
            else
            {
                cboProductUnit.SelectedIndex = cboProductUnit.Items.IndexOf(new ListItem(clsPOItemDetails.ProductUnitCode, clsPOItemDetails.ProductUnitID.ToString()));
            }
            
            txtQuantity.Text = clsPOItemDetails.Quantity.ToString("###0.##0");
            txtPrice.Text = clsPOItemDetails.UnitCost.ToString("###0.##0");
            txtDiscount.Text = clsPOItemDetails.DiscountApplied.ToString("###0.##0");

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

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

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

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

            txtProductCode.Focus();
            ShowCommandButtons(true);
        }
Esempio n. 6
0
		private void LoadItems()
		{
			DataClass clsDataClass = new DataClass();

			POItem clsPOItem = new POItem();
			//lstItem.DataSource = clsDataClass.DataReaderToDataTable(clsPOItem.List(Convert.ToInt64(lblPOID.Text), "POItemID",SortOption.Ascending)).DefaultView;
            lstItem.DataSource = clsPOItem.ListAsDataTable(Convert.ToInt64(lblPOID.Text), "POItemID", SortOption.Ascending).DefaultView;
			lstItem.DataBind();
			clsPOItem.CommitAndDispose();
            lstItemFixCssClass();
		}