예제 #1
0
		private void LoadRecord()
		{
			Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["BranchTransferID"],Session.SessionID));
			BranchTransfer clsBranchTransfer = new BranchTransfer();
			BranchTransferDetails clsDetails = clsBranchTransfer.Details(iID);
			clsBranchTransfer.CommitAndDispose();

            lblBranchTransferID.Text = clsDetails.BranchTransferID.ToString();
            lblBranchTransferNo.Text = clsDetails.BranchTransferNo;
            lblBranchTransferDate.Text = clsDetails.BranchTransferDate.ToString("yyyy-MM-dd HH:mm:ss");
            lblRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd");
            lblBranchCodeFrom.Text = clsDetails.BranchCodeFrom;
            lblBranchCodeTo.Text = clsDetails.BranchCodeTo;
            lblBranchTransferRemarks.Text = clsDetails.Remarks;

            txtBranchTransferDiscountApplied.Text = clsDetails.DiscountApplied.ToString("###0.#0");
            cboBranchTransferDiscountType.SelectedIndex = cboBranchTransferDiscountType.Items.IndexOf(cboBranchTransferDiscountType.Items.FindByValue(clsDetails.DiscountType.ToString("d")));
            lblBranchTransferDiscount.Text = clsDetails.Discount.ToString("#,##0.#0");
            lblBranchTransferVatableAmount.Text = clsDetails.VatableAmount.ToString("#,##0.#0");
            txtBranchTransferFreight.Text = clsDetails.Freight.ToString("#,##0.#0");
            txtBranchTransferDeposit.Text = clsDetails.Deposit.ToString("#,##0.#0");
            lblBranchTransferSubTotal.Text = Convert.ToDecimal(clsDetails.SubTotal - clsDetails.VAT + clsDetails.Freight - clsDetails.Deposit).ToString("#,##0.#0");
            lblBranchTransferVAT.Text = clsDetails.VAT.ToString("#,##0.#0");
            lblBranchTransferTotal.Text = clsDetails.SubTotal.ToString("#,##0.#0");
		}
예제 #2
0
		private void LoadRecord()
		{
            Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["BranchTransferID"], Session.SessionID));
            BranchTransfer clsBranchTransfer = new BranchTransfer();
            BranchTransferDetails clsDetails = clsBranchTransfer.Details(iID);
            clsBranchTransfer.CommitAndDispose();

			lblBranchTransferID.Text = clsDetails.BranchTransferID.ToString();
			lblBranchTransferNo.Text = clsDetails.BranchTransferNo;
            lblBranchTransferDate.Text = clsDetails.BranchTransferDate.ToString("yyyy-MM-dd HH:mm:ss");
			txtRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd");
            cboBranchFrom.SelectedIndex = cboBranchFrom.Items.IndexOf(cboBranchFrom.Items.FindByValue(clsDetails.BranchIDFrom.ToString()));
            cboBranchTo.SelectedIndex = cboBranchTo.Items.IndexOf(cboBranchTo.Items.FindByValue(clsDetails.BranchIDTo.ToString()));
            txtRequestedBy.Text = clsDetails.RequestedBy;
			txtRemarks.Text = clsDetails.Remarks;
		}
예제 #3
0
        private void UpdateDeposit()
        {
            BranchTransferDetails clsBranchTransferDetails = new BranchTransferDetails();
            clsBranchTransferDetails.BranchTransferID = Convert.ToInt64(lblBranchTransferID.Text);
            clsBranchTransferDetails.Deposit = Convert.ToDecimal(txtBranchTransferDeposit.Text);

            BranchTransfer clsBranchTransfer = new BranchTransfer();
            clsBranchTransfer.UpdateDeposit(clsBranchTransferDetails.BranchTransferID, clsBranchTransferDetails.Deposit);
            clsBranchTransfer.SynchronizeAmount(Convert.ToInt64(lblBranchTransferID.Text));
            clsBranchTransferDetails = clsBranchTransfer.Details(Convert.ToInt64(lblBranchTransferID.Text));
            clsBranchTransfer.CommitAndDispose();

            UpdateFooter(clsBranchTransferDetails);
        }
예제 #4
0
        private void UpdateBranchTransferDiscount()
        {
            BranchTransferDetails clsBranchTransferDetails = new BranchTransferDetails();
            clsBranchTransferDetails.BranchTransferID = Convert.ToInt64(lblBranchTransferID.Text);
            clsBranchTransferDetails.DiscountApplied = Convert.ToDecimal(txtBranchTransferDiscountApplied.Text);
            clsBranchTransferDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboBranchTransferDiscountType.SelectedItem.Value);

            BranchTransfer clsBranchTransfer = new BranchTransfer();
            clsBranchTransfer.UpdateDiscount(clsBranchTransferDetails.BranchTransferID, clsBranchTransferDetails.DiscountApplied, clsBranchTransferDetails.DiscountType);
            clsBranchTransfer.SynchronizeAmount(Convert.ToInt64(lblBranchTransferID.Text));
            clsBranchTransferDetails = clsBranchTransfer.Details(Convert.ToInt64(lblBranchTransferID.Text));
            clsBranchTransfer.CommitAndDispose();

            UpdateFooter(clsBranchTransferDetails);
        }
예제 #5
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)
			{
				BranchTransferItem clsBranchTransferItem = new BranchTransferItem();
				clsBranchTransferItem.Delete( stIDs.Substring(0,stIDs.Length-1));

				BranchTransfer clsBranchTransfer = new BranchTransfer(clsBranchTransferItem.Connection, clsBranchTransferItem.Transaction);
				clsBranchTransfer.SynchronizeAmount(Convert.ToInt64(lblBranchTransferID.Text));

				BranchTransferDetails clsBranchTransferDetails = clsBranchTransfer.Details(Convert.ToInt64(lblBranchTransferID.Text));

				clsBranchTransferItem.CommitAndDispose();

                UpdateFooter(clsBranchTransferDetails);
			}

			return boRetValue;
		}
예제 #6
0
		private void SaveRecord()
		{
			BranchTransferItemDetails clsDetails = new BranchTransferItemDetails();

			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.BranchTransferID = Convert.ToInt64(lblBranchTransferID.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);

            BranchTransferItem clsBranchTransferItem = new BranchTransferItem();
            if (lblBranchTransferItemID.Text != "0")
            {
                clsDetails.BranchTransferItemID = Convert.ToInt64(lblBranchTransferItemID.Text);
                clsBranchTransferItem.Update(clsDetails);
            }
            else
                clsBranchTransferItem.Insert(clsDetails);

            BranchTransferDetails clsBranchTransferDetails = new BranchTransferDetails();
            clsBranchTransferDetails.BranchTransferID = clsDetails.BranchTransferID;
            clsBranchTransferDetails.DiscountApplied = Convert.ToDecimal(txtBranchTransferDiscountApplied.Text);
            clsBranchTransferDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboBranchTransferDiscountType.SelectedItem.Value);

            BranchTransfer clsBranchTransfer = new BranchTransfer(clsBranchTransferItem.Connection, clsBranchTransferItem.Transaction);
            clsBranchTransfer.UpdateDiscount(clsDetails.BranchTransferID, clsBranchTransferDetails.DiscountApplied, clsBranchTransferDetails.DiscountType);
            
            clsBranchTransferDetails = clsBranchTransfer.Details(clsDetails.BranchTransferID);
            clsBranchTransferItem.CommitAndDispose();

            UpdateFooter(clsBranchTransferDetails);
		}