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) { SOReturnItems clsSOReturnItems = new SOReturnItems(); clsSOReturnItems.Delete(stIDs.Substring(0, stIDs.Length - 1)); SOReturns clsSOReturns = new SOReturns(clsSOReturnItems.Connection, clsSOReturnItems.Transaction); clsSOReturns.SynchronizeAmount(Convert.ToInt64(lblCreditMemoID.Text)); SOReturnDetails clsSOReturnDetails = clsSOReturns.Details(Convert.ToInt64(lblCreditMemoID.Text)); clsSOReturnItems.CommitAndDispose(); UpdateFooter(clsSOReturnDetails); } return(boRetValue); }
private void UpdateDeposit() { SOReturnDetails clsSOReturnDetails = new SOReturnDetails(); clsSOReturnDetails.CreditMemoID = Convert.ToInt64(lblCreditMemoID.Text); clsSOReturnDetails.Deposit = Convert.ToDecimal(txtSODeposit.Text); SOReturns clsSOReturns = new SOReturns(); clsSOReturns.UpdateDeposit(clsSOReturnDetails.CreditMemoID, clsSOReturnDetails.Deposit); clsSOReturns.SynchronizeAmount(clsSOReturnDetails.CreditMemoID); clsSOReturnDetails = clsSOReturns.Details(clsSOReturnDetails.CreditMemoID); clsSOReturns.CommitAndDispose(); UpdateFooter(clsSOReturnDetails); }
private void UpdateSODiscount() { SOReturnDetails clsSOReturnDetails = new SOReturnDetails(); clsSOReturnDetails.CreditMemoID = Convert.ToInt64(lblCreditMemoID.Text); clsSOReturnDetails.DiscountApplied = Convert.ToDecimal(txtSODiscountApplied.Text); clsSOReturnDetails.DiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboSODiscountType.SelectedItem.Value); SOReturns clsSOReturns = new SOReturns(); clsSOReturns.UpdateDiscount(clsSOReturnDetails.CreditMemoID, clsSOReturnDetails.DiscountApplied, clsSOReturnDetails.DiscountType); clsSOReturns.SynchronizeAmount(Convert.ToInt64(lblCreditMemoID.Text)); clsSOReturnDetails = clsSOReturns.Details(Convert.ToInt64(lblCreditMemoID.Text)); clsSOReturns.CommitAndDispose(); UpdateFooter(clsSOReturnDetails); }
private void LoadRecord() { Common Common = new Common(); Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["retid"], Session.SessionID)); SOReturns clsSOReturns = new SOReturns(); SOReturnDetails clsDetails = clsSOReturns.Details(iID); clsSOReturns.CommitAndDispose(); lblCreditMemoID.Text = clsDetails.CreditMemoID.ToString(); lblReturnNo.Text = clsDetails.CNNo; lblReturnDate.Text = clsDetails.CNDate.ToString("yyyy-MM-dd HH:mm:ss"); lblRequiredReturnDate.Text = clsDetails.RequiredPostingDate.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 = Constants.ROOT_DIRECTORY + "/SalesAndReceivables/_Customer/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; lblReturnRemarks.Text = clsDetails.Remarks; UpdateFooter(clsDetails); }
private void LoadRecord() { Common Common = new Common(); Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["retid"], Session.SessionID)); SOReturns clsSOReturns = new SOReturns(); SOReturnDetails clsDetails = clsSOReturns.Details(iID); clsSOReturns.CommitAndDispose(); lblCreditMemoID.Text = clsDetails.CreditMemoID.ToString(); lnkReturnNo.Text = clsDetails.CNNo; lnkReturnNo.NavigateUrl = "Default.aspx?task=" + Common.Encrypt("details", Session.SessionID) + "&retid=" + Common.Encrypt(clsDetails.CreditMemoID.ToString(), Session.SessionID); lblReturnDate.Text = clsDetails.CNDate.ToString("yyyy-MM-dd HH:mm:ss"); txtRequiredReturnDate.Text = clsDetails.RequiredPostingDate.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; }
private void SaveRecord() { SOReturnItemDetails clsDetails = new SOReturnItemDetails(); 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.CreditMemoID = Convert.ToInt64(lblCreditMemoID.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; SOReturnItems clsSOReturnItems = new SOReturnItems(); if (lblCreditMemoItemID.Text != "0") { clsDetails.CreditMemoItemID = Convert.ToInt64(lblCreditMemoItemID.Text); clsSOReturnItems.Update(clsDetails); } else { clsSOReturnItems.Insert(clsDetails); } SOReturns clsSOReturns = new SOReturns(clsSOReturnItems.Connection, clsSOReturnItems.Transaction); SOReturnDetails clsSOReturnDetails = clsSOReturns.Details(clsDetails.CreditMemoID); clsSOReturnItems.CommitAndDispose(); UpdateFooter(clsSOReturnDetails); }