Esempio n. 1
0
 /// <summary>
 /// editing the ledger on update
 /// </summary>
 public void LedgerEdit()
 {
     try
     {
         AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo();
         AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
         infoAccountLedger.LedgerId = decLedgerId;
         infoAccountLedger.AccountGroupId = 20;
         infoAccountLedger.LedgerName = txtTaxName.Text;
         infoAccountLedger.OpeningBalance = 0;
         infoAccountLedger.IsDefault = false;
         infoAccountLedger.CrOrDr = "Cr";
         infoAccountLedger.Narration = string.Empty;
         infoAccountLedger.MailingName = txtTaxName.Text;
         infoAccountLedger.Address = string.Empty;
         infoAccountLedger.Phone = string.Empty;
         infoAccountLedger.Mobile = string.Empty;
         infoAccountLedger.Email = string.Empty;
         infoAccountLedger.CreditPeriod = 0;
         infoAccountLedger.CreditLimit = 0;
         infoAccountLedger.PricinglevelId = 0;
         infoAccountLedger.BillByBill = false;
         infoAccountLedger.Tin = string.Empty;
         infoAccountLedger.Cst = string.Empty;
         infoAccountLedger.Pan = string.Empty;
         infoAccountLedger.RouteId = 1;
         infoAccountLedger.BankAccountNumber = string.Empty;
         infoAccountLedger.BranchCode = string.Empty;
         infoAccountLedger.BranchName = string.Empty;
         infoAccountLedger.ExtraDate = DateTime.Now;
         infoAccountLedger.Extra1 = string.Empty;
         infoAccountLedger.Extra2 = string.Empty;
         infoAccountLedger.AreaId = 1;
         bllAccountLedger.AccountLedgerEdit(infoAccountLedger);
     }
     catch(Exception ex)
     {
         MessageBox.Show("TAX:13" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 ///Function to edit account ledger
 /// </summary>
 public void EditFunction()
 {
     try
     {
         AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo();
         AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
         infoAccountLedger.LedgerName = txtLedgerName.Text.Trim();
         infoAccountLedger.AccountGroupId = Convert.ToDecimal(cmbGroup.SelectedValue.ToString());
         infoAccountLedger.OpeningBalance = Convert.ToDecimal(((txtOpeningBalance.Text == "") ? "0" : txtOpeningBalance.Text.Trim()));
         infoAccountLedger.CrOrDr = cmbOpeningBalanceCrOrDr.Text.Trim();
         infoAccountLedger.Narration = txtNarration.Text.Trim();
         if (isBankAccount)
         {
             infoAccountLedger.BankAccountNumber = txtAcNo.Text.Trim();
             infoAccountLedger.BranchName = txtBranchName.Text.Trim();
             infoAccountLedger.BranchCode = txtBranchCode.Text.Trim();
         }
         else
         {
             if (isSundryDebtorOrCreditor)
             {
                 infoAccountLedger.BankAccountNumber = txtAccountNo.Text;
                 infoAccountLedger.BranchName = string.Empty;
                 infoAccountLedger.BranchCode = string.Empty;
             }
             else
             {
                 infoAccountLedger.BankAccountNumber = string.Empty;
                 infoAccountLedger.BranchName = string.Empty;
                 infoAccountLedger.BranchCode = string.Empty;
             }
         }
         if (!isDefault)
         {
             infoAccountLedger.IsDefault = false;
         }
         else
         {
             infoAccountLedger.IsDefault = true;
         }
         if (isSundryDebtorOrCreditor)
         {
             infoAccountLedger.MailingName = txtMailingName.Text.Trim();
             infoAccountLedger.Address = txtAddress.Text.Trim();
             infoAccountLedger.Phone = txtPhone.Text.Trim();
             infoAccountLedger.Mobile = txtMobile.Text.Trim();
             infoAccountLedger.Email = txtEmail.Text.Trim();
             infoAccountLedger.CreditPeriod = Convert.ToInt32(txtCreditPeriod.Text.Trim());
             infoAccountLedger.CreditLimit = Convert.ToDecimal(txtCreditLimit.Text.Trim());
             if (cmbPricingLevel.SelectedIndex <= 0)
             {
                 infoAccountLedger.PricinglevelId = 1;
             }
             else
             {
                 infoAccountLedger.PricinglevelId = Convert.ToDecimal(cmbPricingLevel.SelectedValue.ToString());
             }
             if (cmbBillByBill.Text == "Yes")
             {
                 infoAccountLedger.BillByBill = true;
             }
             else
             {
                 infoAccountLedger.BillByBill = false;
             }
             infoAccountLedger.Tin = txtTin.Text.Trim();
             infoAccountLedger.Cst = txtCst.Text.Trim();
             infoAccountLedger.Pan = txtPan.Text.Trim();
             if (cmbArea.SelectedIndex <= 0)
             {
                 infoAccountLedger.AreaId = 1;
             }
             else
             {
                 infoAccountLedger.AreaId = Convert.ToDecimal(cmbArea.SelectedValue.ToString());
             }
             if (cmbRoute.SelectedIndex < 0)
             {
                 infoAccountLedger.RouteId = 1;
             }
             else
             {
                 infoAccountLedger.RouteId = Convert.ToDecimal(cmbRoute.SelectedValue.ToString());
             }
             infoAccountLedger.Extra1 = string.Empty;
             infoAccountLedger.Extra2 = string.Empty;
         }
         else
         {
             infoAccountLedger.MailingName = string.Empty;
             infoAccountLedger.Address = string.Empty;
             infoAccountLedger.State = string.Empty;
             infoAccountLedger.Phone = string.Empty;
             infoAccountLedger.Mobile = string.Empty;
             infoAccountLedger.Email = string.Empty;
             infoAccountLedger.CreditPeriod = 0;
             infoAccountLedger.CreditLimit = 0;
             infoAccountLedger.PricinglevelId = 1;
             infoAccountLedger.BillByBill = false;
             infoAccountLedger.Tin = string.Empty;
             infoAccountLedger.Cst = string.Empty;
             infoAccountLedger.Pan = string.Empty;
             infoAccountLedger.RouteId = 1;
             infoAccountLedger.AreaId = 1;
             infoAccountLedger.Extra1 = string.Empty;
             infoAccountLedger.Extra2 = string.Empty;
             infoAccountLedger.ExtraDate = PublicVariables._dtCurrentDate;
         }
         infoAccountLedger.LedgerId = decAccountLedgerId;
         if (bllAccountLedger.AccountLedgerCheckExistence(txtLedgerName.Text.Trim(), decLedger) == false)
         {
             bllAccountLedger.AccountLedgerEdit(infoAccountLedger);
             LedgerPostingEdit();
             if (cmbBillByBill.Text == "Yes" && isSundryDebtorOrCreditor)
             {
                 PartyBalanceEdit();
             }
             else
             {
                 bllAccountLedger.PartyBalanceDeleteByVoucherTypeVoucherNoAndReferenceType(decAccountLedgerId.ToString(), 1);
             }
             Messages.UpdatedMessage();
             Clear();
         }
         else
         {
             Messages.InformationMessage("Ledgername already exist");
             txtLedgerName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AL2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }