示例#1
0
        private void UpdateDeposit()
        {
            SODetails clsSODetails = new SODetails();
            clsSODetails.SOID = Convert.ToInt64(lblSOID.Text);
            clsSODetails.Deposit = Convert.ToDecimal(txtSODeposit.Text);

            SO clsSO = new SO();
            clsSO.UpdateDeposit(clsSODetails.SOID, clsSODetails.Deposit);
            clsSO.SynchronizeAmount(Convert.ToInt64(lblSOID.Text));
            clsSODetails = clsSO.Details(Convert.ToInt64(lblSOID.Text));
            clsSO.CommitAndDispose();

            UpdateFooter(clsSODetails);
        }
示例#2
0
        private void LoadRecord()
        {
            Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["soid"], Session.SessionID));
            SO clsSO = new SO();
            SODetails clsDetails = clsSO.Details(iID);
            clsSO.CommitAndDispose();

            lblSOID.Text = clsDetails.SOID.ToString();
            lblSONo.Text = clsDetails.SONo;
            lblSODate.Text = clsDetails.SODate.ToString("yyyy-MM-dd HH:mm:ss");
            txtRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd");
            cboCustomer.SelectedIndex = cboCustomer.Items.IndexOf(cboCustomer.Items.FindByValue(clsDetails.CustomerID.ToString()));
            txtCustomerContact.Text = clsDetails.CustomerContact;
            txtCustomerTelephoneNo.Text = clsDetails.CustomerTelephoneNo;
            lblTerms.Text = clsDetails.CustomerTerms.ToString("##0");
            switch (clsDetails.CustomerModeOfTerms)
            {
                case 0:
                    lblModeOfterms.Text = "Days";
                    break;
                case 1:
                    lblModeOfterms.Text = "Months";
                    break;
                case 2:
                    lblModeOfterms.Text = "Years";
                    break;
            }
            txtCustomerAddress.Text = clsDetails.CustomerAddress;
            cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(clsDetails.BranchID.ToString()));
            txtBranchAddress.Text = clsDetails.BranchAddress;
            txtRemarks.Text = clsDetails.Remarks;
        }
示例#3
0
        private void UpdateSODiscount()
        {
            SODetails clsSODetails = new SODetails();
            clsSODetails.SOID = Convert.ToInt64(lblSOID.Text);
            clsSODetails.DiscountApplied = Convert.ToDecimal(txtSODiscountApplied.Text);
            clsSODetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboSODiscountType.SelectedItem.Value);

            SO clsSO = new SO();
            clsSO.UpdateDiscount(clsSODetails.SOID, clsSODetails.DiscountApplied, clsSODetails.DiscountType);
            clsSO.SynchronizeAmount(Convert.ToInt64(lblSOID.Text));
            clsSODetails = clsSO.Details(Convert.ToInt64(lblSOID.Text));
            clsSO.CommitAndDispose();

            UpdateFooter(clsSODetails);
        }
示例#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)
            {
                SOItem clsSOItem = new SOItem();
                clsSOItem.Delete(stIDs.Substring(0, stIDs.Length - 1));

                SO clsSO = new SO(clsSOItem.Connection, clsSOItem.Transaction);
                clsSO.SynchronizeAmount(Convert.ToInt64(lblSOID.Text));

                SODetails clsSODetails = clsSO.Details(Convert.ToInt64(lblSOID.Text));

                clsSOItem.CommitAndDispose();

                UpdateFooter(clsSODetails);
            }

            return boRetValue;
        }
示例#5
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);
        }
示例#6
0
        private void LoadRecord()
        {
            Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["soid"], Session.SessionID));
            SO clsSO = new SO();
            SODetails clsDetails = clsSO.Details(iID);
            clsSO.CommitAndDispose();

            lblSOID.Text = clsDetails.SOID.ToString();
            lnkSONo.Text = clsDetails.SONo;
            lnkSONo.NavigateUrl = "Default.aspx?task=" + Common.Encrypt("details", Session.SessionID) + "&soid=" + Common.Encrypt(clsDetails.SOID.ToString(), Session.SessionID);

            lblSODate.Text = clsDetails.SODate.ToString("yyyy-MM-dd HH:mm:ss");
            lblRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd");
            lblCustomerID.Text = clsDetails.CustomerID.ToString();

            lblCustomerCode.Text = clsDetails.CustomerCode.ToString();
            lblCustomerCode.NavigateUrl = "../_Customer/Default.aspx?task=" + Common.Encrypt("details", Session.SessionID) + "&id=" + Common.Encrypt(clsDetails.CustomerID.ToString(), Session.SessionID);

            lblCustomerContact.Text = clsDetails.CustomerContact;
            lblCustomerTelephoneNo.Text = clsDetails.CustomerTelephoneNo;
            lblTerms.Text = clsDetails.CustomerTerms.ToString("##0");
            switch (clsDetails.CustomerModeOfTerms)
            {
                case 0:
                    lblModeOfterms.Text = "Days";
                    break;
                case 1:
                    lblModeOfterms.Text = "Months";
                    break;
                case 2:
                    lblModeOfterms.Text = "Years";
                    break;
            }
            lblCustomerAddress.Text = clsDetails.CustomerAddress;
            lblBranchID.Text = clsDetails.BranchID.ToString();
            lblBranchCode.Text = clsDetails.BranchCode;
            lblBranchAddress.Text = clsDetails.BranchAddress;
            lblSORemarks.Text = clsDetails.Remarks;

            txtSODiscountApplied.Text = clsDetails.DiscountApplied.ToString("###0.#0");
            cboSODiscountType.SelectedIndex = cboSODiscountType.Items.IndexOf(cboSODiscountType.Items.FindByValue(clsDetails.DiscountType.ToString("d")));
            lblSODiscount.Text = clsDetails.Discount.ToString("#,##0.#0");
            lblSOVatableAmount.Text = clsDetails.VatableAmount.ToString("#,##0.#0");
            txtSOFreight.Text = clsDetails.Freight.ToString("#,##0.#0");
            txtSODeposit.Text = clsDetails.Deposit.ToString("#,##0.#0");
            lblSOSubTotal.Text = Convert.ToDecimal(clsDetails.SubTotal - clsDetails.VAT).ToString("#,##0.#0");
            lblSOVAT.Text = clsDetails.VAT.ToString("#,##0.#0");
            lblSOTotal.Text = clsDetails.SubTotal.ToString("#,##0.#0");
        }
示例#7
0
		private void LoadRecord()
		{
			Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["poid"],Session.SessionID));
			SO clsSO = new SO();
			SODetails clsDetails = clsSO.Details(iID);
			clsSO.CommitAndDispose();

			lblSOID.Text = clsDetails.SOID.ToString();
			lblSONo.Text = clsDetails.SONo;
			lblSODate.Text = clsDetails.SODate.ToString("yyyy-MM-dd HH:mm:ss");
			lblRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd");
			lblCustomerID.Text = clsDetails.CustomerID.ToString();

			lblCustomerCode.Text = clsDetails.CustomerCode.ToString();
			string stParam = "?task=" + Common.Encrypt("details",Session.SessionID) + "&id=" + Common.Encrypt(clsDetails.CustomerID.ToString(),Session.SessionID);	
			lblCustomerCode.NavigateUrl = "/RetailPlus/SalesAndReceivables/_Vendor/Default.aspx" + stParam;

			lblCustomerContact.Text = clsDetails.CustomerContact;
			lblCustomerTelephoneNo.Text = clsDetails.CustomerTelephoneNo;
			lblTerms.Text = clsDetails.CustomerTerms.ToString("##0");
			switch (clsDetails.CustomerModeOfTerms)
			{
				case 0: 
					lblModeOfterms.Text = "Days"; 
					break;
				case 1:
					lblModeOfterms.Text = "Months"; 
					break;
				case 2:
					lblModeOfterms.Text = "Years"; 
					break;
			}
			lblCustomerAddress.Text = clsDetails.CustomerAddress;
			lblBranchID.Text = clsDetails.BranchID.ToString();
			lblBranchCode.Text = clsDetails.BranchCode;
			lblBranchAddress.Text = clsDetails.BranchAddress;
			lblSORemarks.Text = clsDetails.Remarks;

			lblSOSubTotal.Text = Convert.ToDecimal(clsDetails.SubTotal - clsDetails.VAT).ToString("#,##0.#0");
			lblSOVAT.Text = clsDetails.VAT.ToString("#,##0.#0");
			lblSOTotal.Text = clsDetails.SubTotal.ToString("#,##0.#0");
		}