/// <summary>
        /// Save function
        /// </summary>
        public void SaveFunction()
        {
            try
            {
                DateValidation Objdatevalidation = new DateValidation();
                OtherDateValidationFunction ObjotherdateValidation = new OtherDateValidationFunction();
                Objdatevalidation.DateValidationFunction(txtVoucherDate);
                ObjotherdateValidation.DateValidationFunction(txtCheckDate, false);
                DataTable dtblMaster = new DataTable();
                SettingsBll BllSettings = new SettingsBll();
                PDCRecivebleBll BllPdcreceivable = new PDCRecivebleBll();
                PDCReceivableMasterInfo InfopdcRecivable = new PDCReceivableMasterInfo();
                PartyBalanceBll BllPartyBalance = new PartyBalanceBll();
                InfopdcRecivable.VoucherNo = strVoucherNo;
                InfopdcRecivable.InvoiceNo = txtVoucherNo.Text.Trim();
                InfopdcRecivable.Date = DateTime.Parse(txtVoucherDate.Text);
                InfopdcRecivable.LedgerId = Convert.ToDecimal(cmbAccountLedger.SelectedValue.ToString());
                InfopdcRecivable.Amount = decimal.Parse(txtAmount.Text);
                InfopdcRecivable.Narration = txtNarration.Text;
                if (txtcheckNo.Text != string.Empty)
                    InfopdcRecivable.ChequeNo = txtcheckNo.Text;
                else
                    InfopdcRecivable.ChequeNo = string.Empty;
                if (txtCheckDate.Text != string.Empty)
                    InfopdcRecivable.ChequeDate = Convert.ToDateTime(txtCheckDate.Text);
                else
                    InfopdcRecivable.ChequeDate = DateTime.Now;
                InfopdcRecivable.UserId = PublicVariables._decCurrentUserId;
                InfopdcRecivable.VoucherTypeId = decPDCReceivableVoucherTypeId;
                if (cmbBank.SelectedValue != null && cmbBank.SelectedValue.ToString() != string.Empty)
                {
                    InfopdcRecivable.BankId = Convert.ToDecimal(cmbBank.SelectedValue.ToString());
                }
                else
                    InfopdcRecivable.BankId = 0;
                InfopdcRecivable.ExtraDate = DateTime.Now;
                InfopdcRecivable.Extra1 = string.Empty;
                InfopdcRecivable.Extra2 = string.Empty;
                if (!isInEditMode)
                {
                    decimal decIdentity = BllPdcreceivable.PDCReceivableMasterAdd(InfopdcRecivable);
                    LedgerPosting();
                    PartyBalanceAddOrEdit();
                    Messages.SavedMessage();
                    if (cbxPrint.Checked)
                    {
                        if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                        {
                            PrintForDotMatrix(decIdentity);
                        }
                        else
                        {
                            Print(decIdentity);
                        }
                    }
                    ClearFunction();
                }
                else
                {

                    decimal decIdentity = decPDCReceivableEditId;
                    InfopdcRecivable.PdcReceivableMasterId = decPDCReceivableEditId;
                    BllPdcreceivable.PDCReceivableMasterEdit(InfopdcRecivable);

                    LedgerPostingBll BllLedgerPosting = new LedgerPostingBll();
                    BllLedgerPosting.LedgerPostingDeleteByVoucherNoVoucherTypeIdAndLedgerId(strVoucherNo, decPDCReceivableVoucherTypeId, 12);
                    BllPartyBalance.PartyBalanceDeleteByVoucherTypeAndVoucherNo(decPDCReceivableVoucherTypeId, strVoucherNo);
                    PartyBalanceAddOrEdit();
                    LedgerPostingEdit(decPDCReceivableEditId);
                    Messages.UpdatedMessage();
                    if (cbxPrint.Checked)
                    {
                        if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                        {
                            PrintForDotMatrix(decIdentity);
                        }
                        else
                        {
                            Print(decIdentity);
                        }
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PR9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Date validation and set the date format
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void txtCheckDate_Leave(object sender, EventArgs e)
 {
     try
     {
         OtherDateValidationFunction obj = new OtherDateValidationFunction();
         bool isInvalid = obj.DateValidationFunction(txtCheckDate, false);
         if (!isInvalid)
         {
             txtCheckDate.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy");
         }
         string date = txtCheckDate.Text;
         dtpcheckdate.Value = Convert.ToDateTime(date);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PR55:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #3
0
 /// <summary>
 /// Save Function
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         DateValidation Objdatevalidation = new DateValidation();
         OtherDateValidationFunction ObjotherdateValidation = new OtherDateValidationFunction();
         Objdatevalidation.DateValidationFunction(txtVoucherDate);
         AccountLedgerSP SpAccountLedger = new AccountLedgerSP();
         SettingsSP spSettings = new SettingsSP();
         txtVoucherDate.Text = txtVoucherDate.Text.Trim();
         cmbvouchertype.Text = cmbvouchertype.Text.Trim();
         txtAmount.Text = txtAmount.Text.Trim();
         txtBank.Text = txtBank.Text.Trim();
         txtcheckdate.Text = txtcheckdate.Text.Trim();
         txtcheckNo.Text = txtcheckNo.Text.Trim();
         txtNarration.Text = txtNarration.Text.Trim();
         DataTable dtblMaster = new DataTable();
         PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP();
         PDCClearanceMasterInfo infoPdcclearance = new PDCClearanceMasterInfo();
         infoPdcclearance.SuffixPrefixId = decSufixprefixPdcpayableID;
         infoPdcclearance.FinancialYearId = Convert.ToDecimal(PublicVariables._decCurrentFinancialYearId.ToString());
         infoPdcclearance.VoucherNo = strVoucherNo;
         infoPdcclearance.InvoiceNo = txtvoucherNo.Text;
         if (txtVoucherDate.Text != string.Empty)
             infoPdcclearance.Date = Convert.ToDateTime(txtVoucherDate.Text);
         else
             infoPdcclearance.Date = DateTime.Now;
         infoPdcclearance.LedgerId = decimal.Parse(strledgerId.ToString());
         infoPdcclearance.AgainstId = decmasterId;
         infoPdcclearance.UserId = PublicVariables._decCurrentUserId;
         infoPdcclearance.VoucherTypeId = decPDCclearanceVoucherTypeId;
         infoPdcclearance.Status = cmbStatus.Text.ToString();
         infoPdcclearance.Type = cmbvouchertype.Text.ToString();
         infoPdcclearance.ExtraDate = DateTime.Now;
         infoPdcclearance.Narration = txtNarration.Text;
         infoPdcclearance.Extra1 = string.Empty;
         infoPdcclearance.Extra2 = string.Empty;
         if (!isInEditMode)
         {
             decimal decIdentity = sppdcClearance.PDCClearanceMasterAdd(infoPdcclearance);
             LedgerPostingAdd();
             if (cmbStatus.Text.ToString() == "Bounced")
             {
                 if (SpAccountLedger.AccountGroupIdCheck(txtAccountLedger.Text.ToString()))
                 {
                     PartyBalanceAddOrEdit();
                 }
             }
             Messages.SavedMessage();
             if (cbxPrint.Checked)
             {
                 if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                 {
                     PrintForDotMatrix(decIdentity);
                 }
                 else
                 {
                     Print(decIdentity);
                 }
             }
             ClearFunction();
         }
         else
         {
             decimal decIdentity = decPDCClearanceEditId;
             infoPdcclearance.PDCClearanceMasterId = decPDCClearanceEditId;
             sppdcClearance.PDCClearanceMasterEdit(infoPdcclearance);
             SpAccountLedger.LedgerPostingDeleteByVoucherTypeAndVoucherNo(strVoucherNo, decPDCclearanceVoucherTypeId);
             LedgerPostingAdd();
             SpAccountLedger.PartyBalanceDeleteByVoucherTypeVoucherNoAndReferenceType(strVoucherNo, decPDCclearanceVoucherTypeId);
             if (cmbStatus.Text.ToString() == "Bounced")
             {
                 if (SpAccountLedger.AccountGroupIdCheck(txtAccountLedger.Text.ToString()))
                 {
                     PartyBalanceAddOrEdit();
                 }
             }
             Messages.UpdatedMessage();
             if (cbxPrint.Checked)
             {
                 if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                 {
                     PrintForDotMatrix(decIdentity);
                 }
                 else
                 {
                     Print(decIdentity);
                 }
             }
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }