Beispiel #1
0
 /// <summary>
 /// edit function
 /// </summary>
 private void EditFunction()
 {
     try
     {
         AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo();
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         infoAccountLedger.LedgerName = txtSupplierName.Text.Trim();
         infoAccountLedger.MailingName = txtMailingName.Text.Trim();
         if (txtOpeningBalance.Text.Trim() != string.Empty)
         {
             infoAccountLedger.OpeningBalance = Convert.ToDecimal(txtOpeningBalance.Text.ToString());
         }
         else
         {
             infoAccountLedger.OpeningBalance = 0;
         }
         infoAccountLedger.CrOrDr = cmbDrOrCr.Text.ToString();
         infoAccountLedger.BankAccountNumber = txtAcNo.Text.Trim();
         infoAccountLedger.BranchName = txtBranchName.Text.Trim();
         infoAccountLedger.BranchCode = txtBranchCode.Text.Trim();
         infoAccountLedger.Mobile = txtMobile.Text.Trim();
         infoAccountLedger.Address = txtAddress.Text.Trim();
         if (cmbBillbyBill.Text == "Yes")
         {
             infoAccountLedger.BillByBill = true;
         }
         else
         {
             infoAccountLedger.BillByBill = false;
         }
         infoAccountLedger.Cst = txtCst.Text.Trim();
         infoAccountLedger.AreaId = Convert.ToDecimal(cmbArea.SelectedValue.ToString());
         infoAccountLedger.RouteId = Convert.ToDecimal(cmbRoute.SelectedValue.ToString());
         infoAccountLedger.MailingName = txtMailingName.Text.Trim();
         infoAccountLedger.Phone = txtPhone.Text.Trim();
         infoAccountLedger.Email = txtEmail.Text.Trim();
         infoAccountLedger.Tin = txtTin.Text.Trim();
         infoAccountLedger.Pan = txtPan.Text.Trim();
         infoAccountLedger.Narration = txtNarration.Text.Trim();
         infoAccountLedger.LedgerId = decLedger;
         if (spAccountLedger.AccountLedgerCheckExistenceForSalesman(txtSupplierName.Text.Trim().ToString(), decLedger) == false)
         {
             spAccountLedger.AccountLedgerEditForSalesman(infoAccountLedger);
             ledgerUpdate();
             if (cmbBillbyBill.Text == "Yes")
             {
                 partyBalanceUpdate();
             }
             else
             {
                 AccountLedgerSP spLedger = new AccountLedgerSP();
                 spLedger.PartyBalanceDeleteByVoucherTypeVoucherNoAndReferenceType(decLedger.ToString(), 1);
             }
             Messages.UpdatedMessage();
             Clear();
         }
         else
         {
             Messages.InformationMessage("Supplier name already exist");
             txtSupplierName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SUP10" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #2
0
 /// <summary>
 /// save function
 /// </summary>
 public void SaveFunction()
 {
     decimal decOpeningBalance = 0;
     try
     {
         AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo();
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         infoAccountLedger.AccountGroupId = 22;
         infoAccountLedger.LedgerName = txtSupplierName.Text.Trim();
         if (txtOpeningBalance.Text.Trim() != string.Empty)
         {
             infoAccountLedger.OpeningBalance = Convert.ToDecimal(txtOpeningBalance.Text.ToString());
             decOpeningBalance = infoAccountLedger.OpeningBalance;
         }
         else
         {
             infoAccountLedger.OpeningBalance = 0;
         }
         infoAccountLedger.CrOrDr = cmbDrOrCr.Text.Trim().ToString();
         infoAccountLedger.MailingName = txtMailingName.Text.Trim();
         infoAccountLedger.BankAccountNumber = txtAcNo.Text.Trim();
         infoAccountLedger.BranchName = txtBranchName.Text.Trim();
         infoAccountLedger.BranchCode = txtBranchCode.Text.Trim();
         infoAccountLedger.Phone = txtPhone.Text.Trim();
         infoAccountLedger.Mobile = txtMobile.Text.Trim();
         infoAccountLedger.Address = txtAddress.Text.Trim();
         if (cmbBillbyBill.Text == "Yes")
         {
             infoAccountLedger.BillByBill = true;
         }
         else
         {
             infoAccountLedger.BillByBill = false;
         }
         infoAccountLedger.CreditLimit = 0;
         infoAccountLedger.CreditPeriod = 0;
         infoAccountLedger.Cst = txtCst.Text.Trim();
         infoAccountLedger.AreaId = Convert.ToDecimal(cmbArea.SelectedValue.ToString());
         infoAccountLedger.RouteId = Convert.ToDecimal(cmbRoute.SelectedValue.ToString());
         infoAccountLedger.MailingName = txtMailingName.Text.Trim();
         infoAccountLedger.Email = txtEmail.Text.Trim();
         infoAccountLedger.PricinglevelId = 26;
         infoAccountLedger.Tin = txtTin.Text.Trim();
         infoAccountLedger.Pan = txtPan.Text.Trim();
         infoAccountLedger.Narration = txtNarration.Text.Trim();
         infoAccountLedger.IsDefault = false;
         infoAccountLedger.Extra1 = string.Empty;
         infoAccountLedger.Extra2 = string.Empty;
         if (spAccountLedger.AccountLedgerCheckExistenceForSalesman(txtSupplierName.Text.Trim().ToString(), 0) == false)
         {
             decLedgerId = spAccountLedger.AccountLedgerAddForCustomer(infoAccountLedger);
             if (decOpeningBalance > 0)
             {
                 ledgerPosting();
                 if (cmbBillbyBill.Text == "Yes")
                 {
                     partyBalance();
                 }
             }
             Messages.SavedMessage();
             Clear();
         }
         else
         {
             Messages.InformationMessage("Ledger name already exist");
             txtSupplierName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SUP8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }