private void UpdateDeposit() { WBranchTransferDetails clsWBranchTransferDetails = new WBranchTransferDetails(); clsWBranchTransferDetails.WBranchTransferID = Convert.ToInt64(lblWBranchTransferID.Text); clsWBranchTransferDetails.Deposit = Convert.ToDecimal(txtWBranchTransferDeposit.Text); WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); clsWBranchTransfer.UpdateDeposit(clsWBranchTransferDetails.WBranchTransferID, clsWBranchTransferDetails.Deposit); clsWBranchTransfer.SynchronizeAmount(Convert.ToInt64(lblWBranchTransferID.Text)); clsWBranchTransferDetails = clsWBranchTransfer.Details(Convert.ToInt64(lblWBranchTransferID.Text)); clsWBranchTransfer.CommitAndDispose(); UpdateFooter(clsWBranchTransferDetails); }
private void LoadRecord() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["WBranchTransferID"], Session.SessionID)); WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); WBranchTransferDetails clsDetails = clsWBranchTransfer.Details(iID); clsWBranchTransfer.CommitAndDispose(); lblWBranchTransferID.Text = clsDetails.WBranchTransferID.ToString(); lblWBranchTransferNo.Text = clsDetails.WBranchTransferNo; lblWBranchTransferDate.Text = clsDetails.WBranchTransferDate.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; }
private void UpdateWBranchTransferDiscount() { WBranchTransferDetails clsWBranchTransferDetails = new WBranchTransferDetails(); clsWBranchTransferDetails.WBranchTransferID = Convert.ToInt64(lblWBranchTransferID.Text); clsWBranchTransferDetails.DiscountApplied = Convert.ToDecimal(txtWBranchTransferDiscountApplied.Text); clsWBranchTransferDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboWBranchTransferDiscountType.SelectedItem.Value); WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); clsWBranchTransfer.UpdateDiscount(clsWBranchTransferDetails.WBranchTransferID, clsWBranchTransferDetails.DiscountApplied, clsWBranchTransferDetails.DiscountType); clsWBranchTransfer.SynchronizeAmount(Convert.ToInt64(lblWBranchTransferID.Text)); clsWBranchTransferDetails = clsWBranchTransfer.Details(Convert.ToInt64(lblWBranchTransferID.Text)); clsWBranchTransfer.CommitAndDispose(); UpdateFooter(clsWBranchTransferDetails); }
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; }
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); }
private void LoadRecord() { Int64 iID = 0; try { iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["WBranchTransferID"], Session.SessionID)); } catch { } try { if (iID == 0) iID = Convert.ToInt64(lblWBranchTransferID.Text);} catch { } WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); WBranchTransferDetails clsDetails = clsWBranchTransfer.Details(iID); clsWBranchTransfer.CommitAndDispose(); lblWBranchTransferID.Text = clsDetails.WBranchTransferID.ToString(); lnkWBranchTransferNo.Text = clsDetails.WBranchTransferNo; lnkWBranchTransferNo.NavigateUrl = "Default.aspx?task=" + Common.Encrypt("details", Session.SessionID) + "&WBranchTransferID=" + Common.Encrypt(clsDetails.WBranchTransferID.ToString(), Session.SessionID); lblWBranchTransferDate.Text = clsDetails.WBranchTransferDate.ToString("yyyy-MM-dd HH:mm:ss"); lblRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd"); lblBranchCodeFrom.Text = clsDetails.BranchCodeFrom; lblBranchCodeTo.Text = clsDetails.BranchCodeTo; lblWBranchTransferRemarks.Text = clsDetails.Remarks; txtWBranchTransferDiscountApplied.Text = clsDetails.DiscountApplied.ToString("###0.#0"); cboWBranchTransferDiscountType.SelectedIndex = cboWBranchTransferDiscountType.Items.IndexOf(cboWBranchTransferDiscountType.Items.FindByValue(clsDetails.DiscountType.ToString("d"))); lblWBranchTransferDiscount.Text = clsDetails.Discount.ToString("#,##0.#0"); lblWBranchTransferVatableAmount.Text = clsDetails.VatableAmount.ToString("#,##0.#0"); txtWBranchTransferFreight.Text = clsDetails.Freight.ToString("#,##0.#0"); txtWBranchTransferDeposit.Text = clsDetails.Deposit.ToString("#,##0.#0"); lblWBranchTransferSubTotal.Text = Convert.ToDecimal(clsDetails.SubTotal - clsDetails.VAT).ToString("#,##0.#0"); lblWBranchTransferVAT.Text = clsDetails.VAT.ToString("#,##0.#0"); lblWBranchTransferTotal.Text = clsDetails.SubTotal.ToString("#,##0.#0"); lblStatus.Text = clsDetails.Status.ToString("G"); }
private void LoadRecord() { Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["WBranchTransferID"], Session.SessionID)); WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); WBranchTransferDetails clsDetails = clsWBranchTransfer.Details(iID); clsWBranchTransfer.CommitAndDispose(); lblWBranchTransferID.Text = clsDetails.WBranchTransferID.ToString(); lblWBranchTransferNo.Text = clsDetails.WBranchTransferNo; lblWBranchTransferDate.Text = clsDetails.WBranchTransferDate.ToString("yyyy-MM-dd HH:mm:ss"); lblRequiredDeliveryDate.Text = clsDetails.RequiredDeliveryDate.ToString("yyyy-MM-dd"); lblBranchCodeFrom.Text = clsDetails.BranchCodeFrom; lblBranchCodeTo.Text = clsDetails.BranchCodeTo; lblWBranchTransferRemarks.Text = clsDetails.Remarks; txtWBranchTransferDiscountApplied.Text = clsDetails.DiscountApplied.ToString("###0.#0"); cboWBranchTransferDiscountType.SelectedIndex = cboWBranchTransferDiscountType.Items.IndexOf(cboWBranchTransferDiscountType.Items.FindByValue(clsDetails.DiscountType.ToString("d"))); lblWBranchTransferDiscount.Text = clsDetails.Discount.ToString("#,##0.#0"); lblWBranchTransferVatableAmount.Text = clsDetails.VatableAmount.ToString("#,##0.#0"); txtWBranchTransferFreight.Text = clsDetails.Freight.ToString("#,##0.#0"); txtWBranchTransferDeposit.Text = clsDetails.Deposit.ToString("#,##0.#0"); lblWBranchTransferSubTotal.Text = Convert.ToDecimal(clsDetails.SubTotal - clsDetails.VAT + clsDetails.Freight - clsDetails.Deposit).ToString("#,##0.#0"); lblWBranchTransferVAT.Text = clsDetails.VAT.ToString("#,##0.#0"); lblWBranchTransferTotal.Text = clsDetails.SubTotal.ToString("#,##0.#0"); }