/// <summary>
 /// Function to search the details
 /// </summary>
 public void Search()
 {
     try
     {
         if (cmbAccountLedger.Text.Trim() == string.Empty)
         {
             cmbAccountLedger.Text = "All";
         }
         else if (cmbVoucherType.Text.Trim() == string.Empty)
         {
             cmbVoucherType.Text = "All";
         }
         else if (cmbStatus.Text.Trim() == string.Empty)
         {
             cmbStatus.Text = "All";
         }
         DataTable          dtblPDCReport = new DataTable();
         PDCPayableMasterSP sppdcpayable  = new PDCPayableMasterSP();
         dtblPDCReport = sppdcpayable.PdcPayableReportSearch(Convert.ToDateTime(dtpFrmDate.Value.ToString()), Convert.ToDateTime(dtpTodate.Value.ToString()), cmbVoucherType.Text.ToString(), cmbAccountLedger.Text.ToString(), Convert.ToDateTime(dtpCheckDateFrom.Value.ToString()), Convert.ToDateTime(dtpCheckdateTo.Value.ToString()), txtcheckNo.Text.Trim(), txtVoucherNo.Text.Trim(), cmbStatus.Text.Trim());
         dgvPDCPayableReport.DataSource = dtblPDCReport;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PPREP5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #2
0
 /// <summary>
 /// Function to search the details
 /// </summary>
 public void Search()
 {
     try
     {
         if (cmbAccountLedger.Text.Trim() == string.Empty)
         {
             cmbAccountLedger.Text = "All";
         }
         else if (cmbVoucherType.Text.Trim() == string.Empty)
         {
             cmbVoucherType.Text = "All";
         }
         else if (cmbStatus.Text.Trim() == string.Empty)
         {
             cmbStatus.Text = "All";
         }
         DataTable          dtblPDCReport = new DataTable();
         PDCPayableMasterSP sppdcpayable  = new PDCPayableMasterSP();
         dtblPDCReport = sppdcpayable.PdcPayableReportSearch(Convert.ToDateTime(dtpFrmDate.Value.ToString()), Convert.ToDateTime(dtpTodate.Value.ToString()), cmbVoucherType.Text.ToString(), cmbAccountLedger.Text.ToString(), Convert.ToDateTime(dtpCheckDateFrom.Value.ToString()), Convert.ToDateTime(dtpCheckdateTo.Value.ToString()), txtcheckNo.Text.Trim(), txtVoucherNo.Text.Trim(), cmbStatus.Text.Trim());
         dgvPDCPayableReport.DataSource = dtblPDCReport;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PPREP5:" + ex.Message;
     }
 }
Пример #3
0
 /// <summary>
 /// CashorBank Account ComboFill
 /// </summary>
 public void cmbBankAccountFill()
 {
     try
     {
         PDCPayableMasterSP sppdcpayble = new PDCPayableMasterSP();
         cmbBank.DataSource = null;
         DataTable dtblBank = sppdcpayble.BankAccountComboFill();
         cmbBank.DataSource = dtblBank;
         cmbBank.DisplayMember = "ledgerName";
         cmbBank.ValueMember = "ledgerId";
         cmbBank.SelectedIndex = -1;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PR1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #4
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridSearchRegister()
 {
     try
     {
         if (cmbAccountLedger.Text.Trim() == string.Empty)
         {
             cmbAccountLedger.Text = "ALL";
         }
         DataTable          dtbl         = new DataTable();
         PDCPayableMasterSP spPdcpayable = new PDCPayableMasterSP();
         dtbl = spPdcpayable.PDCpayableRegisterSearch(Convert.ToDateTime(dtpfromDate.Value.ToString()), Convert.ToDateTime(dtpTodate.Value.ToString()), txtvoucherNo.Text.Trim(), cmbAccountLedger.Text.ToString());
         dgvpdcPayableRegister.DataSource = dtbl;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PPREG1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #5
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridSearchRegister()
 {
     try
     {
         if (cmbAccountLedger.Text.Trim() == string.Empty)
         {
             cmbAccountLedger.Text = "ALL";
         }
         DataTable dtbl = new DataTable();
         PDCPayableMasterSP spPdcpayable = new PDCPayableMasterSP();
         dtbl = spPdcpayable.PDCpayableRegisterSearch(Convert.ToDateTime(dtpfromDate.Value.ToString()), Convert.ToDateTime(dtpTodate.Value.ToString()), txtvoucherNo.Text.Trim(), cmbAccountLedger.Text.ToString());
         dgvpdcPayableRegister.DataSource = dtbl;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PPREG1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #6
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridSearchRegister()
 {
     try
     {
         if (cmbAccountLedger.Text.Trim() == string.Empty)
         {
             cmbAccountLedger.Text = "ALL";
         }
         DataTable          dtbl         = new DataTable();
         PDCPayableMasterSP spPdcpayable = new PDCPayableMasterSP();
         dtbl = spPdcpayable.PDCpayableRegisterSearch(Convert.ToDateTime(dtpfromDate.Value.ToString()), Convert.ToDateTime(dtpTodate.Value.ToString()), txtvoucherNo.Text.Trim(), cmbAccountLedger.Text.ToString());
         dgvpdcPayableRegister.DataSource = dtbl;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PPREG1:" + ex.Message;
     }
 }
 /// <summary>
 /// Function to print the details
 /// </summary>
 public void Print()
 {
     try
     {
         string             strFromDate        = txtFromDate.Text.ToString();
         string             strToDate          = txtTodate.Text.ToString();
         decimal            decVoucherTypeId   = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString());
         decimal            decLedgerId        = Convert.ToDecimal(cmbAccountLedger.SelectedValue.ToString());
         PDCPayableMasterSP sppdcpayable       = new PDCPayableMasterSP();
         DataSet            dsPdcPayableReport = sppdcpayable.PdcpayableReportPrinting(Convert.ToDateTime(dtpFrmDate.Value.ToString()), Convert.ToDateTime(dtpTodate.Value.ToString()), cmbVoucherType.Text.ToString(), cmbAccountLedger.Text.ToString(), Convert.ToDateTime(dtpCheckDateFrom.Value.ToString()), Convert.ToDateTime(dtpCheckdateTo.Value.ToString()), txtcheckNo.Text.Trim(), txtVoucherNo.Text.Trim(), cmbStatus.Text.Trim(), 1);
         frmReport          frmReport          = new frmReport();
         frmReport.MdiParent = formMDI.MDIObj;
         frmReport.PdcpayablereportReportPrinting(dsPdcPayableReport);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PPREP6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill AccountLedger combobox
 /// </summary>
 public void AccountLedgerComboFill()
 {
     try
     {
         DataTable dtbl = new DataTable();
         PDCPayableMasterSP sppdcpayable = new PDCPayableMasterSP();
         dtbl = sppdcpayable.AccountLedgerComboFill(false);
         DataRow dr = dtbl.NewRow();
         dr["ledgerId"] = 0;
         dr["ledgerName"] = "All";
         dtbl.Rows.InsertAt(dr, 0);
         cmbAccountLedger.DataSource = dtbl;
         cmbAccountLedger.ValueMember = "ledgerId";
         cmbAccountLedger.DisplayMember = "ledgerName";
         cmbAccountLedger.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PCREG2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #9
0
 /// <summary>
 /// Function to fill AccountLedger combobox
 /// </summary>
 public void AccountLedgerComboFill()
 {
     try
     {
         DataTable          dtbl         = new DataTable();
         PDCPayableMasterSP sppdcpayable = new PDCPayableMasterSP();
         dtbl = sppdcpayable.AccountLedgerComboFill(false);
         DataRow dr = dtbl.NewRow();
         dr["ledgerId"]   = 0;
         dr["ledgerName"] = "All";
         dtbl.Rows.InsertAt(dr, 0);
         cmbAccountLedger.DataSource    = dtbl;
         cmbAccountLedger.ValueMember   = "ledgerId";
         cmbAccountLedger.DisplayMember = "ledgerName";
         cmbAccountLedger.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PCREG3:" + ex.Message;
     }
 }
Пример #10
0
 /// <summary>
 /// Function to fill AccountLedger combobox
 /// </summary>
 public void AccountLedgerComboFill()
 {
     try
     {
         DataTable          dtbl         = new DataTable();
         PDCPayableMasterSP sppdcpayable = new PDCPayableMasterSP();
         dtbl = sppdcpayable.AccountLedgerComboFill(false);
         DataRow dr = dtbl.NewRow();
         dr["ledgerId"]   = 0;
         dr["ledgerName"] = "All";
         dtbl.Rows.InsertAt(dr, 0);
         cmbAccountLedger.DataSource    = dtbl;
         cmbAccountLedger.ValueMember   = "ledgerId";
         cmbAccountLedger.DisplayMember = "ledgerName";
         cmbAccountLedger.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PRREP3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #11
0
 /// <summary>
 /// Function to fill Bank combobox
 /// </summary>
 public void cmbBankAccountFill()
 {
     try
     {
         PDCPayableMasterSP sppdcpayble = new PDCPayableMasterSP();
         cmbBank.DataSource = null;
         DataTable dtblBank = sppdcpayble.BankAccountComboFill();
         DataRow   dr       = dtblBank.NewRow();
         dr["ledgerId"]   = 0;
         dr["ledgerName"] = "All";
         dtblBank.Rows.InsertAt(dr, 0);
         cmbBank.DataSource    = dtblBank;
         cmbBank.DisplayMember = "ledgerName";
         cmbBank.ValueMember   = "ledgerId";
         cmbBank.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PCREG3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #12
0
 /// <summary>
 /// Function to fill Bank combobox
 /// </summary>
 public void cmbBankAccountFill()
 {
     try
     {
         PDCPayableMasterSP sppdcpayble = new PDCPayableMasterSP();
         cmbBank.DataSource = null;
         DataTable dtblBank = sppdcpayble.BankAccountComboFill();
         DataRow   dr       = dtblBank.NewRow();
         dr["ledgerId"]   = 0;
         dr["ledgerName"] = "All";
         dtblBank.Rows.InsertAt(dr, 0);
         cmbBank.DataSource    = dtblBank;
         cmbBank.DisplayMember = "ledgerName";
         cmbBank.ValueMember   = "ledgerId";
         cmbBank.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PCREG4:" + ex.Message;
     }
 }
Пример #13
0
        /// <summary>
        /// Ledger Posting Function, here saving the curresponding details into the ledger
        /// </summary>
        public void LedgerPostingAdd()
        {
            try
            {
                string strstatus = cmbStatus.Text.ToString();
                LedgerPostingInfo InfoPosting = new LedgerPostingInfo();
                LedgerPostingSP SpLedgerPosting = new LedgerPostingSP();
                AccountLedgerSP SpLedger = new AccountLedgerSP();
                LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo();
                PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP();
                PDCPayableMasterInfo infoPDCPayable = new PDCPayableMasterInfo();
                PDCPayableMasterSP spPDCPayable = new PDCPayableMasterSP();
                PDCReceivableMasterInfo infoPDCReceivable = new PDCReceivableMasterInfo();
                PDCReceivableMasterSP spPDCReceivable = new PDCReceivableMasterSP();
                strVoucherType = sppdcClearance.TypeOfVoucherReturnUnderVoucherName(cmbvouchertype.Text.ToString());
                if (strVoucherType == "PDC Payable")
                {
                    infoPDCPayable = spPDCPayable.PDCPayableMasterView(Convert.ToDecimal(cmbInvoiceNo.SelectedValue.ToString()));
                    infoLedgerPosting.VoucherNo = strVoucherNo;
                    infoLedgerPosting.InvoiceNo = txtvoucherNo.Text.Trim();
                    infoLedgerPosting.Date = Convert.ToDateTime(txtVoucherDate.Text.ToString());
                    infoLedgerPosting.VoucherTypeId = decPDCclearanceVoucherTypeId;
                    infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
                    infoLedgerPosting.ChequeDate = Convert.ToDateTime(txtcheckdate.Text.ToString());
                    infoLedgerPosting.ChequeNo = txtcheckNo.Text.Trim();
                    infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate;
                    infoLedgerPosting.Extra1 = string.Empty;
                    infoLedgerPosting.Extra2 = string.Empty;
                    if (strstatus == "Cleared")
                    {

                        infoLedgerPosting.LedgerId = infoPDCPayable.BankId;
                        infoLedgerPosting.Debit = 0;
                        infoLedgerPosting.Credit = Convert.ToDecimal(txtAmount.Text.ToString());
                    }
                    else if (strstatus == "Bounced")
                    {
                        infoLedgerPosting.LedgerId = infoPDCPayable.LedgerId;
                        infoLedgerPosting.Debit = 0;
                        infoLedgerPosting.Credit = Convert.ToDecimal(txtAmount.Text.ToString());
                    }
                    SpLedgerPosting.LedgerPostingAdd(infoLedgerPosting);
                    infoLedgerPosting.VoucherTypeId = decPDCclearanceVoucherTypeId;
                    infoLedgerPosting.VoucherNo = txtvoucherNo.Text.Trim();
                    infoLedgerPosting.Date = Convert.ToDateTime(txtVoucherDate.Text.ToString());
                    infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
                    infoLedgerPosting.ChequeDate = Convert.ToDateTime(txtcheckdate.Text);
                    infoLedgerPosting.ChequeNo = txtcheckNo.Text.Trim();
                    infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate;
                    infoLedgerPosting.Extra1 = string.Empty;
                    infoLedgerPosting.Extra2 = string.Empty;
                    infoLedgerPosting.VoucherNo = strVoucherNo;
                    infoLedgerPosting.InvoiceNo = txtvoucherNo.Text.Trim();
                    infoLedgerPosting.LedgerId = 6;
                    infoLedgerPosting.Debit = Convert.ToDecimal(txtAmount.Text.ToString());
                    infoLedgerPosting.Credit = 0;
                    SpLedgerPosting.LedgerPostingAdd(infoLedgerPosting);
                }
                else if (strVoucherType == "PDC Receivable")
                {
                    infoPDCReceivable = spPDCReceivable.PDCReceivableMasterView(Convert.ToDecimal(cmbInvoiceNo.SelectedValue.ToString()));
                    infoLedgerPosting.VoucherTypeId = decPDCclearanceVoucherTypeId;
                    infoLedgerPosting.VoucherNo = strVoucherNo;
                    infoLedgerPosting.InvoiceNo = txtvoucherNo.Text.Trim();
                    infoLedgerPosting.Date = PublicVariables._dtCurrentDate;
                    infoLedgerPosting.LedgerId = 7;
                    infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
                    infoLedgerPosting.Debit = 0;
                    infoLedgerPosting.Credit = Convert.ToDecimal(txtAmount.Text.ToString());
                    infoLedgerPosting.ChequeDate = Convert.ToDateTime(txtcheckdate.Text.ToString());
                    infoLedgerPosting.ChequeNo = txtcheckNo.Text.Trim();
                    infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate;
                    infoLedgerPosting.Extra1 = string.Empty;
                    infoLedgerPosting.Extra2 = string.Empty;
                    SpLedgerPosting.LedgerPostingAdd(infoLedgerPosting);
                    infoLedgerPosting.VoucherTypeId = decPDCclearanceVoucherTypeId;
                    infoLedgerPosting.Date = PublicVariables._dtCurrentDate;
                    if (strstatus == "Cleared")
                    {
                        infoLedgerPosting.LedgerId = infoPDCReceivable.BankId;
                    }
                    else if (strstatus == "Bounced")
                    {
                        infoLedgerPosting.LedgerId = infoPDCReceivable.LedgerId;
                    }
                    infoLedgerPosting.VoucherNo = strVoucherNo;
                    infoLedgerPosting.InvoiceNo = txtvoucherNo.Text.Trim();
                    infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
                    infoLedgerPosting.Debit = Convert.ToDecimal(txtAmount.Text.ToString());
                    infoLedgerPosting.Credit = 0;
                    infoLedgerPosting.ChequeDate = Convert.ToDateTime(txtcheckdate.Text);
                    infoLedgerPosting.ChequeNo = txtcheckNo.Text.Trim();
                    infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate;
                    infoLedgerPosting.Extra1 = string.Empty;
                    infoLedgerPosting.Extra2 = string.Empty;
                    SpLedgerPosting.LedgerPostingAdd(infoLedgerPosting);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #14
0
        /// <summary>
        /// Save Or edit function, here checking the invalid entries
        /// </summary>
        public void SaveOrEditFunction()
        {
            try
            {
                bool isOk = true;
                if (isOk)
                    if (txtvoucherNo.Text == string.Empty)
                    {
                        Messages.InformationMessage("Enter voucher no");
                        txtvoucherNo.Focus();
                    }
                    else if (txtVoucherDate.Text == string.Empty)
                    {
                        Messages.InformationMessage("Select date");
                        txtVoucherDate.Focus();
                    }
                    else if (cmbvouchertype.SelectedValue == null)
                    {
                        Messages.InformationMessage("Select voucher type");
                        cmbvouchertype.Focus();
                    }
                    else if (cmbInvoiceNo.SelectedValue == null)
                    {
                        Messages.InformationMessage("Select against invoice no");
                        cmbInvoiceNo.Focus();
                    }
                    else if (cmbStatus.Text == string.Empty)
                    {
                        Messages.InformationMessage("Select status");
                        cmbStatus.Focus();
                    }
                    else
                    {
                        if (PublicVariables.isMessageAdd)
                        {
                            isOk = false;
                            PDCClearanceMasterSP sppdcClerance = new PDCClearanceMasterSP();
                            if (!isInEditMode)
                            {
                                if (Messages.SaveMessage())
                                    if (!sppdcClerance.PDCclearanceCheckExistence(txtvoucherNo.Text.Trim(), decPDCclearanceVoucherTypeId, 0))
                                    {
                                        SaveFunction();
                                    }
                                    else
                                    {
                                        Messages.InformationMessage("Voucher number already exist");
                                    }
                            }
                            else if (isInEditMode)
                            {
                                if (Messages.UpdateMessage())
                                {
                                    SaveFunction();
                                }
                            }
                        }
                        if (isOk)
                        {
                            if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
                            {
                                PDCPayableMasterSP SpPDCpayable = new PDCPayableMasterSP();

                                if (isInEditMode)
                                {
                                    SaveFunction();
                                }
                                else
                                {
                                    SaveFunction();
                                }
                            }
                            else
                            {
                                Messages.NoPrivillageMessage();
                            }
                        }
                    }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #15
0
 /// <summary>
 /// Function to print the details
 /// </summary>
 public void Print()
 {
     try
     {
         string strFromDate = txtFromDate.Text.ToString();
         string strToDate = txtTodate.Text.ToString();
         decimal decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString());
         decimal decLedgerId = Convert.ToDecimal(cmbAccountLedger.SelectedValue.ToString());
         PDCPayableMasterSP sppdcpayable = new PDCPayableMasterSP();
         DataSet dsPdcPayableReport = sppdcpayable.PdcpayableReportPrinting(Convert.ToDateTime(dtpFrmDate.Value.ToString()), Convert.ToDateTime(dtpTodate.Value.ToString()), cmbVoucherType.Text.ToString(), cmbAccountLedger.Text.ToString(), Convert.ToDateTime(dtpCheckDateFrom.Value.ToString()), Convert.ToDateTime(dtpCheckdateTo.Value.ToString()), txtcheckNo.Text.Trim(), txtVoucherNo.Text.Trim(), cmbStatus.Text.Trim(), 1);
         frmReport frmReport = new frmReport();
         frmReport.MdiParent = formMDI.MDIObj;
         frmReport.PdcpayablereportReportPrinting(dsPdcPayableReport);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PPREP6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #16
0
        /// <summary>
        /// Save or edit function, its for checking the invalid entries
        /// </summary>
        public void SaveOrEditFunction()
        {
            try
            {
                txtVoucherDate.Text = txtVoucherDate.Text.Trim();
                cmbAccountLedger.Text = cmbAccountLedger.Text.Trim();
                txtAmount.Text = txtAmount.Text.Trim();
                cmbBank.Text = cmbBank.Text.Trim();
                txtChequeDate.Text = txtChequeDate.Text.Trim();
                txtcheckNo.Text = txtcheckNo.Text.Trim();
                txtNarration.Text = txtNarration.Text.Trim();
                bool isOk = true;
                bool isAmountOk = false;
                try
                {
                    if (decimal.Parse(txtAmount.Text) > 0)
                        isAmountOk = true;
                }
                catch
                {
                    txtAmount.Text = string.Empty;
                }
                if (isOk)
                {
                    if (txtvoucherNo.Text == string.Empty)
                    {
                        Messages.InformationMessage("Enter voucher no");
                        txtvoucherNo.Focus();
                    }
                    else if (txtVoucherDate.Text == string.Empty)
                    {
                        Messages.InformationMessage("Select date");
                        txtVoucherDate.Focus();
                    }
                    else if (cmbAccountLedger.SelectedValue == null)
                    {
                        Messages.InformationMessage("Select account ledger");
                        cmbAccountLedger.Focus();
                    }
                    else if (!isAmountOk)
                    {
                        Messages.InformationMessage("Select amount");
                        txtAmount.Focus();
                    }
                    else if (cmbBank.SelectedValue == null)
                    {
                        Messages.InformationMessage("Select bank ");
                        cmbBank.Focus();
                    }
                    else if (txtcheckNo.Text == string.Empty)
                    {
                        Messages.InformationMessage("Enter cheque no");
                        txtcheckNo.Focus();
                    }
                    else if (txtChequeDate.Text == string.Empty)
                    {
                        Messages.InformationMessage("Select cheque date");
                        txtChequeDate.Focus();
                    }
                    else
                    {
                        if (PublicVariables.isMessageAdd)
                        {
                            isOk = false;
                            PDCPayableMasterSP SpPDCpayable = new PDCPayableMasterSP();
                            if (!isInEditMode)
                            {
                                if (Messages.SaveMessage())
                                    if (!SpPDCpayable.PDCpayableCheckExistence(txtvoucherNo.Text.Trim(), decPDCpayableVoucherTypeId, 0))
                                    {
                                        SaveFunction();
                                    }
                                    else
                                    {
                                        Messages.InformationMessage("Voucher number already exist");
                                    }
                            }
                            else
                            {
                                if (Messages.UpdateMessage())
                                    if (isInEditMode && SpPDCpayable.PDCPayableVoucherCheckRreference(decPDCpayableEditId, decPDCpayableVoucherTypeId))
                                    {
                                        MessageBox.Show("Can't update,reference exist", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    }
                                    else
                                    {
                                        SaveFunction();
                                    }
                                if (BillallocationObj != null)
                                {
                                    this.Close();
                                    BillallocationObj.Enabled = true;
                                    BillallocationObj.BillAllocationGridFill();
                                }
                            }
                        }
                        if (isOk)
                        {
                            if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
                            {
                                PDCPayableMasterSP SpPDCpayable = new PDCPayableMasterSP();

                                if (isInEditMode && SpPDCpayable.PDCPayableVoucherCheckRreference(decPDCpayableEditId, decPDCpayableVoucherTypeId))
                                {
                                    MessageBox.Show("Can't update,reference exist", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                                else
                                {
                                    SaveFunction();
                                }
                            }
                            else
                            {
                                Messages.NoPrivillageMessage();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PP12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #17
0
 /// <summary>
 /// Save function
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         SettingsSP spSettings = new SettingsSP();
         DateValidation Objdatevalidation = new DateValidation();
         OtherDateValidationFunction ObjotherdateValidation = new OtherDateValidationFunction();
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         PartyBalanceSP spPartyBalance = new PartyBalanceSP();
         Objdatevalidation.DateValidationFunction(txtVoucherDate);
         ObjotherdateValidation.DateValidationFunction(txtChequeDate, false);
         DataTable dtblMaster = new DataTable();
         PDCPayableMasterInfo InfoPayable = new PDCPayableMasterInfo();
         PDCPayableMasterSP SpPayable = new PDCPayableMasterSP();
         InfoPayable.VoucherNo = strVoucherNo;
         InfoPayable.InvoiceNo = txtvoucherNo.Text.Trim();
         InfoPayable.Date = DateTime.Parse(txtVoucherDate.Text);
         InfoPayable.LedgerId = Convert.ToDecimal(cmbAccountLedger.SelectedValue.ToString());
         InfoPayable.Amount = decimal.Parse(txtAmount.Text);
         InfoPayable.Narration = txtNarration.Text;
         InfoPayable.ChequeNo = txtcheckNo.Text;
         if (txtChequeDate.Text != string.Empty)
             InfoPayable.ChequeDate = Convert.ToDateTime(txtChequeDate.Text);
         else
             InfoPayable.ChequeDate = DateTime.Now;
         InfoPayable.UserId = PublicVariables._decCurrentUserId;
         InfoPayable.VoucherTypeId = decPDCpayableVoucherTypeId;
         if (cmbBank.SelectedValue != null && cmbBank.SelectedValue.ToString() != string.Empty)
         {
             InfoPayable.BankId = Convert.ToDecimal(cmbBank.SelectedValue.ToString());
         }
         else
             InfoPayable.ExtraDate = DateTime.Now;
         InfoPayable.Extra1 = string.Empty;
         InfoPayable.Extra2 = string.Empty;
         if (!isInEditMode)
         {
             decimal decIdentity = SpPayable.PDCPayableMasterAdd(InfoPayable);
             LedgerPosting();
             PartyBalanceAddOrEdit();
             Messages.SavedMessage();
             if (cbxPrint.Checked)
             {
                 if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                 {
                     PrintForDotMatrix(decIdentity);
                 }
                 else
                 {
                     Print(decIdentity);
                 }
             }
             ClearFunction();
         }
         else
         {
             decimal decIdentity = decPDCpayableEditId;
             InfoPayable.PdcPayableMasterId = decPDCpayableEditId;
             SpPayable.PDCPayableMasterEdit(InfoPayable);
             LedgerPostingSP spLedgerPosting = new LedgerPostingSP();
             spLedgerPosting.LedgerPostingDeleteByVoucherNoVoucherTypeIdAndLedgerId(strVoucherNo, decPDCpayableVoucherTypeId, 12);
             spPartyBalance.PartyBalanceDeleteByVoucherTypeAndVoucherNo(decPDCpayableVoucherTypeId, strVoucherNo);
             PartyBalanceAddOrEdit();
             LedgerPostingEdit(decPDCpayableEditId);
             Messages.UpdatedMessage();
             if (cbxPrint.Checked)
             {
                 if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                 {
                     PrintForDotMatrix(decIdentity);
                 }
                 else
                 {
                     Print(decIdentity);
                 }
             }
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PP7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #18
0
        /// <summary>
        /// On double clicking the cell in grid, it loads the corresponding Voucher to update or delete the entries
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvBillAllocation_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    decVoucherTypeId = Convert.ToDecimal(dgvBillAllocation.CurrentRow.Cells["voucherTypeId"].Value.ToString());

                    strTypeOfVoucher = dgvBillAllocation.CurrentRow.Cells["typeOfVoucher"].Value.ToString();
                    strVoucherNo = dgvBillAllocation.CurrentRow.Cells["voucherNo"].Value.ToString();
                    if (strTypeOfVoucher == "PDC Payable")
                    {
                        PDCPayableMasterSP sp = new PDCPayableMasterSP();
                        decimal decMasterId = sp.PdcPayableMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmPdcPayable frmpdcPayableObj = new frmPdcPayable();
                        frmpdcPayableObj = Application.OpenForms["frmPdcPayable"] as frmPdcPayable;

                        if (frmpdcPayableObj == null)
                        {
                            frmpdcPayableObj = new frmPdcPayable();
                            frmpdcPayableObj.MdiParent = formMDI.MDIObj;

                            frmpdcPayableObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "PDC Receivable")
                    {
                        PDCReceivableMasterSP sp = new PDCReceivableMasterSP();
                        decimal decMasterId = sp.PdcReceivableMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmPdcReceivable frmPdcReceivableObj = new frmPdcReceivable();
                        frmPdcReceivableObj = Application.OpenForms["frmPdcReceivable"] as frmPdcReceivable;
                        if (frmPdcReceivableObj == null)
                        {
                            frmPdcReceivableObj = new frmPdcReceivable();
                            frmPdcReceivableObj.MdiParent = formMDI.MDIObj;
                            frmPdcReceivableObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Payment Voucher")
                    {
                        PaymentMasterSP sp = new PaymentMasterSP();
                        decimal decMasterId = sp.paymentMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmPaymentVoucher frmPaymentVoucherObj = new frmPaymentVoucher();
                        frmPaymentVoucherObj = Application.OpenForms["frmPaymentVoucher"] as frmPaymentVoucher;
                        if (frmPaymentVoucherObj == null)
                        {
                            frmPaymentVoucherObj = new frmPaymentVoucher();
                            frmPaymentVoucherObj.MdiParent = formMDI.MDIObj;

                            frmPaymentVoucherObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Receipt Voucher")
                    {

                        ReceiptMasterSP sp = new ReceiptMasterSP();
                        decimal decMasterId = sp.ReceiptMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmReceiptVoucher frmReceiptVoucherObj = new frmReceiptVoucher();
                        frmReceiptVoucherObj = Application.OpenForms["frmReceiptVoucher"] as frmReceiptVoucher;
                        if (frmReceiptVoucherObj == null)
                        {
                            frmReceiptVoucherObj = new frmReceiptVoucher();
                            frmReceiptVoucherObj.MdiParent = formMDI.MDIObj;

                            frmReceiptVoucherObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Journal Voucher")
                    {
                        JournalMasterSP sp = new JournalMasterSP();
                        decimal decMasterId = sp.JournalMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmJournalVoucher frmJournalVoucherObj = new frmJournalVoucher();
                        frmJournalVoucherObj = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
                        if (frmJournalVoucherObj == null)
                        {
                            frmJournalVoucherObj = new frmJournalVoucher();
                            frmJournalVoucherObj.MdiParent = formMDI.MDIObj;

                            frmJournalVoucherObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Credit Note")
                    {
                        CreditNoteMasterSP sp = new CreditNoteMasterSP();
                        decimal decMasterId = sp.CreditNoteMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmCreditNote frmCreditNoteObj = new frmCreditNote();
                        frmCreditNoteObj = Application.OpenForms["frmCreditNote"] as frmCreditNote;
                        if (frmCreditNoteObj == null)
                        {
                            frmCreditNoteObj = new frmCreditNote();
                            frmCreditNoteObj.MdiParent = formMDI.MDIObj;

                            frmCreditNoteObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Debit Note")
                    {
                        DebitNoteMasterSP sp = new DebitNoteMasterSP();
                        decimal decMasterId = sp.DebitNoteMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmDebitNote frmDebitNoteObj = new frmDebitNote();
                        frmDebitNoteObj = Application.OpenForms["frmDebitNote"] as frmDebitNote;
                        if (frmDebitNoteObj == null)
                        {
                            frmDebitNoteObj = new frmDebitNote();
                            frmDebitNoteObj.MdiParent = formMDI.MDIObj;

                            frmDebitNoteObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                }
            }
            catch (Exception ex)
            {

                MessageBox.Show("BA:15" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #19
0
        /// <summary>
        /// When doubleclicking on the grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvReport_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            decimal decVouchertypeId = 0;
            string  strVoucherNo     = string.Empty;

            try
            {
                if (dgvReport.CurrentRow.Index == e.RowIndex)
                {
                    if ((dgvReport.CurrentRow.Cells["voucherTypeId"].Value != null && dgvReport.CurrentRow.Cells["voucherTypeId"].Value.ToString() != string.Empty))
                    {
                        int inI = dgvReport.CurrentCell.RowIndex;
                        foreach (DataGridViewRow dgv in dgvReport.Rows)
                        {
                            if (dgv.Cells["VoucherNo"].Value != null && dgv.Cells["VoucherNo"].Value.ToString() != string.Empty &&
                                dgv.Cells["voucherTypeId"].Value != null && dgv.Cells["voucherTypeId"].Value.ToString() != string.Empty)
                            {
                                strVoucherType   = dgv.Cells["VoucherType"].Value.ToString();
                                decVouchertypeId = Convert.ToDecimal(dgv.Cells["voucherTypeId"].Value.ToString());
                                strVoucherNo     = dgv.Cells["VoucherNo"].Value.ToString();
                            }
                            else
                            {
                                if (dgv.Cells["ledgerId"].Value.ToString() != string.Empty)
                                {
                                    decledgerId    = decimal.Parse(dgv.Cells["ledgerId"].Value.ToString());
                                    strVoucherType = dgv.Cells["Account Ledger"].Value.ToString();
                                    frmLedgerDetails frmLedger = new frmLedgerDetails();
                                    frmLedger = Application.OpenForms["frmLedgerDetails"] as frmLedgerDetails;
                                    if (frmLedger == null)
                                    {
                                        frmLedger           = new frmLedgerDetails();
                                        frmLedger.MdiParent = formMDI.MDIObj;
                                        frmLedger.callFromAgeing(this, decledgerId);
                                        this.Enabled = false;
                                    }
                                }
                            }
                            if (dgv.Index == inI)
                            {
                                break;
                            }
                        }
                        if (strVoucherType == "Payment Voucher")
                        {
                            PaymentMasterSP spPaymentMaster = new PaymentMasterSP();
                            decMasterId = spPaymentMaster.paymentMasterIdView(decVouchertypeId, strVoucherNo);
                            frmPaymentVoucher frmPaymentVoucher = new frmPaymentVoucher();
                            frmPaymentVoucher = Application.OpenForms["frmPaymentVoucher"] as frmPaymentVoucher;
                            if (frmPaymentVoucher == null)
                            {
                                frmPaymentVoucher           = new frmPaymentVoucher();
                                frmPaymentVoucher.MdiParent = formMDI.MDIObj;
                                frmPaymentVoucher.callFromAgeing(this, decMasterId);
                                this.Enabled = false;
                            }
                        }
                        else if (strVoucherType == "Receipt Voucher")
                        {
                            ReceiptMasterSP spRecieptMaster = new ReceiptMasterSP();
                            decMasterId = spRecieptMaster.ReceiptMasterIdView(decVouchertypeId, strVoucherNo);
                            frmReceiptVoucher frmReceiptVoucher = new frmReceiptVoucher();
                            frmReceiptVoucher = Application.OpenForms["frmReceiptVoucher"] as frmReceiptVoucher;
                            if (frmReceiptVoucher == null)
                            {
                                frmReceiptVoucher           = new frmReceiptVoucher();
                                frmReceiptVoucher.MdiParent = formMDI.MDIObj;
                                frmReceiptVoucher.callFromAgeing(this, decMasterId);
                                this.Enabled = false;
                            }
                        }
                        else if (strVoucherType == "Journal Voucher")
                        {
                            JournalMasterSP spJournalMaster = new JournalMasterSP();
                            decMasterId = spJournalMaster.JournalMasterIdView(decVouchertypeId, strVoucherNo);
                            frmJournalVoucher frmJournalVoucher = new frmJournalVoucher();
                            frmJournalVoucher = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
                            if (frmJournalVoucher == null)
                            {
                                frmJournalVoucher           = new frmJournalVoucher();
                                frmJournalVoucher.MdiParent = formMDI.MDIObj;
                                frmJournalVoucher.callFromAgeing(this, decMasterId);
                                this.Enabled = false;
                            }
                        }
                        else if (strVoucherType == "PDC Receivable")
                        {
                            PDCReceivableMasterSP spPdcRecievabl = new PDCReceivableMasterSP();
                            decMasterId = spPdcRecievabl.PdcReceivableMasterIdView(decVouchertypeId, strVoucherNo);
                            frmPdcReceivable frmPdcReceivable = new frmPdcReceivable();
                            frmPdcReceivable = Application.OpenForms["frmPdcReceivable"] as frmPdcReceivable;
                            if (frmPdcReceivable == null)
                            {
                                frmPdcReceivable           = new frmPdcReceivable();
                                frmPdcReceivable.MdiParent = formMDI.MDIObj;
                                frmPdcReceivable.callFromAgeing(this, decMasterId);
                                this.Enabled = false;
                            }
                        }
                        else if (strVoucherType == "PDC Payable")
                        {
                            PDCPayableMasterSP spPdcPayable = new PDCPayableMasterSP();
                            decMasterId = spPdcPayable.PdcPayableMasterIdView(decVouchertypeId, strVoucherNo);
                            frmPdcPayable frmPdcPayable = new frmPdcPayable();
                            frmPdcPayable = Application.OpenForms["frmPdcPayable"] as frmPdcPayable;
                            if (frmPdcPayable == null)
                            {
                                frmPdcPayable           = new frmPdcPayable();
                                frmPdcPayable.MdiParent = formMDI.MDIObj;
                                frmPdcPayable.callFromAgeing(this, decMasterId);
                                this.Enabled = false;
                            }
                        }
                        else if (strVoucherType == "Sales Invoice")
                        {
                            SalesMasterSP spMaster = new SalesMasterSP();
                            decMasterId = spMaster.SalesMasterIdViewByvoucherNoAndVoucherType(decVouchertypeId, strVoucherNo);
                            SalesMasterSP   spSalesMaster   = new SalesMasterSP();
                            bool            blPOS           = spSalesMaster.DayBookSalesInvoiceOrPOS(decMasterId, decVouchertypeId);
                            frmSalesInvoice frmSalesInvoice = new frmSalesInvoice();
                            frmPOS          frmPOS          = new frmPOS();
                            if (blPOS == true)
                            {
                                frmPOS = Application.OpenForms["frmPOS"] as frmPOS;
                                if (frmPOS == null)
                                {
                                    frmPOS           = new frmPOS();
                                    frmPOS.MdiParent = formMDI.MDIObj;
                                    frmPOS.callFromAgeing(this, decMasterId);
                                    this.Enabled = false;
                                }
                            }
                            else
                            {
                                frmSalesInvoice = Application.OpenForms["frmSalesInvoice"] as frmSalesInvoice;
                                if (frmSalesInvoice == null)
                                {
                                    frmSalesInvoice           = new frmSalesInvoice();
                                    frmSalesInvoice.MdiParent = formMDI.MDIObj;
                                    frmSalesInvoice.callFromAgeing(this, decMasterId);
                                    this.Enabled = false;
                                }
                            }
                        }
                        else if (strVoucherType == "Purchase Invoice")
                        {
                            PurchaseMasterSP spPurchaseMaster = new PurchaseMasterSP();
                            decMasterId = spPurchaseMaster.PurchaseMasterIdViewByvoucherNoAndVoucherType(decVouchertypeId, strVoucherNo);
                            frmPurchaseInvoice objpurchase = new frmPurchaseInvoice();
                            objpurchase.WindowState = FormWindowState.Normal;
                            objpurchase.MdiParent   = formMDI.MDIObj;
                            objpurchase.callFromAgeing(this, decMasterId);
                            this.Enabled = false;
                        }
                        else if (strVoucherType == "Credit Note")
                        {
                            CreditNoteMasterSP spCreditNoteMaster = new CreditNoteMasterSP();
                            decMasterId = spCreditNoteMaster.CreditNoteMasterIdView(decVouchertypeId, strVoucherNo);
                            frmCreditNote objpurchase = new frmCreditNote();
                            objpurchase.WindowState = FormWindowState.Normal;
                            objpurchase.MdiParent   = formMDI.MDIObj;
                            objpurchase.callFromAgeing(this, decMasterId);
                            this.Enabled = false;
                        }
                        else if (strVoucherType == "Debit Note")
                        {
                            DebitNoteMasterSP spDebitNote = new DebitNoteMasterSP();
                            decMasterId = spDebitNote.DebitNoteMasterIdView(decVouchertypeId, strVoucherNo);
                            frmDebitNote objpurchase = new frmDebitNote();
                            objpurchase.WindowState = FormWindowState.Normal;
                            objpurchase.MdiParent   = formMDI.MDIObj;
                            objpurchase.callFromAgeing(this, decMasterId);
                            this.Enabled = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("AR17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #20
0
 /// <summary>
 /// Delete function
 /// </summary>
 /// <param name="decPDCpayableMasterId"></param>
 public void DeleteFunction(decimal decPDCpayableMasterId)
 {
     try
     {
         PDCPayableMasterSP sppdcpayable = new PDCPayableMasterSP();
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         PartyBalanceSP spPartyBalance = new PartyBalanceSP();
         if (!spPartyBalance.PartyBalanceCheckReference(decPDCpayableVoucherTypeId, strVoucherNo))
         {
             sppdcpayable.PDCPayableMasterDelete(decPDCpayableMasterId, decPDCpayableVoucherTypeId, strVoucherNo);
             Messages.DeletedMessage();
         }
         else
         {
             Messages.InformationMessage("Reference exist. Cannot delete");
             txtVoucherDate.Focus();
         }
         if (PDCPayableRegisterObj != null)
         {
             this.Close();
             PDCPayableRegisterObj.Enabled = true;
         }
         else if (PDCpayableReportObj != null)
         {
             this.Close();
             PDCpayableReportObj.Enabled = true;
         }
         else if (frmVoucherSearch != null)
         {
             this.Close();
             frmVoucherSearch.GridFill();
         }
         else if (frmLedgerDetailsObj != null)
         {
             this.Close();
         }
         else if (frmDayBookObj != null)
         {
             this.Close();
         }
         else if (BillallocationObj != null)
         {
             this.Close();
         }
         else
         {
             ClearFunction();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PP23:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #21
0
        /// <summary>
        /// Ledger posting edit function
        /// </summary>
        /// <param name="decpdcMasterId"></param>
        public void LedgerPostingEdit(decimal decpdcMasterId)
        {
            PDCPayableMasterSP SpPDCPayable = new PDCPayableMasterSP();
            DataTable dtblLedgerPostingId = new DataTable();
            LedgerPostingSP SpLedgerPosting = new LedgerPostingSP();
            LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo();
            ExchangeRateSP SpExchangRate = new ExchangeRateSP();
            decimal decOldExchange = 0;
            decimal decNewExchangeRate = 0;
            decimal decNewExchangeRateId = 0;
            decimal decSelectedCurrencyRate = 0;
            decimal decAmount = 0;
            decimal decConvertRate = 0;
            string strReferenceType = string.Empty;
            decimal decOldExchangeId = 0;
            try
            {
                
                dtblLedgerPostingId = SpPDCPayable.LedgerPostingIdByPDCpayableId(decpdcMasterId);
                decimal decledgerpostingId1 = Convert.ToDecimal(dtblLedgerPostingId.Rows[0]["ledgerPostingId"].ToString());
                decimal decLedgerPostingId2 = Convert.ToDecimal(dtblLedgerPostingId.Rows[1]["ledgerPostingId"].ToString());
                if (!btnAgainstRef.Enabled)
                {
                    infoLedgerPosting.LedgerPostingId = decledgerpostingId1;
                    infoLedgerPosting.VoucherTypeId = decPDCpayableVoucherTypeId;
                    infoLedgerPosting.VoucherNo = strVoucherNo;
                    infoLedgerPosting.InvoiceNo = txtvoucherNo.Text.Trim();
                    infoLedgerPosting.Date = PublicVariables._dtCurrentDate;
                    infoLedgerPosting.LedgerId = Convert.ToDecimal(cmbAccountLedger.SelectedValue.ToString());
                    infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
                    infoLedgerPosting.Debit = Convert.ToDecimal(txtAmount.Text.ToString());
                    infoLedgerPosting.Credit = 0;
                    infoLedgerPosting.ChequeDate = Convert.ToDateTime(txtChequeDate.Text);
                    infoLedgerPosting.ChequeNo = txtcheckNo.Text.Trim();
                    infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate;
                    infoLedgerPosting.Extra1 = string.Empty;
                    infoLedgerPosting.Extra2 = string.Empty;
                    SpLedgerPosting.LedgerPostingEdit(infoLedgerPosting);

                }
                else
                {
                    infoLedgerPosting.LedgerPostingId = decledgerpostingId1;
                    infoLedgerPosting.VoucherTypeId = decPDCpayableVoucherTypeId;
                    infoLedgerPosting.VoucherNo = strVoucherNo;
                    infoLedgerPosting.InvoiceNo = txtvoucherNo.Text.Trim();
                    infoLedgerPosting.Date = PublicVariables._dtCurrentDate;
                    infoLedgerPosting.LedgerId = Convert.ToDecimal(cmbAccountLedger.SelectedValue.ToString());
                    infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
                    infoLedgerPosting.Credit = 0;
                    foreach (DataRow dr in dtblPartyBalance.Rows)
                    {
                        if (infoLedgerPosting.LedgerId == Convert.ToDecimal(dr["LedgerId"].ToString()))
                        {
                            decOldExchange = Convert.ToDecimal(dr["OldExchangeRate"].ToString());
                            decNewExchangeRateId = Convert.ToDecimal(dr["CurrencyId"].ToString());
                            decSelectedCurrencyRate = SpExchangRate.GetExchangeRateByExchangeRateId(decOldExchange);
                            decAmount = Convert.ToDecimal(dr["Amount"].ToString());
                            decConvertRate = decConvertRate + (decAmount * decSelectedCurrencyRate);

                        }
                    }
                    infoLedgerPosting.Debit = decConvertRate;

                    infoLedgerPosting.ChequeDate = Convert.ToDateTime(txtChequeDate.Text);
                    infoLedgerPosting.ChequeNo = txtcheckNo.Text.Trim();
                    infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate;
                    infoLedgerPosting.Extra1 = string.Empty;
                    infoLedgerPosting.Extra2 = string.Empty;
                    SpLedgerPosting.LedgerPostingEdit(infoLedgerPosting);
                    infoLedgerPosting.LedgerId = 12;
                    foreach (DataRow dr in dtblPartyBalance.Rows)
                    {
                        if (Convert.ToDecimal(cmbAccountLedger.SelectedValue.ToString()) == Convert.ToDecimal(dr["LedgerId"].ToString()))
                        {
                            if (dr["ReferenceType"].ToString() == "Against")
                            {
                                decNewExchangeRateId = Convert.ToDecimal(dr["CurrencyId"].ToString());
                                decNewExchangeRate = SpExchangRate.GetExchangeRateByExchangeRateId(decNewExchangeRateId);
                                decOldExchangeId = Convert.ToDecimal(dr["OldExchangeRate"].ToString());
                                decOldExchange = SpExchangRate.GetExchangeRateByExchangeRateId(decOldExchangeId);
                                decAmount = Convert.ToDecimal(dr["Amount"].ToString());
                                decimal decForexAmount = (decAmount * decNewExchangeRate) - (decAmount * decOldExchange);
                                if (decForexAmount >= 0)
                                {

                                    infoLedgerPosting.Debit = decForexAmount;
                                    infoLedgerPosting.Credit = 0;
                                }
                                else
                                {
                                    infoLedgerPosting.Credit = -1 * decForexAmount;
                                    infoLedgerPosting.Debit = 0;
                                }
                                SpLedgerPosting.LedgerPostingAdd(infoLedgerPosting);
                            }
                        }

                    }
                }

                infoLedgerPosting.LedgerPostingId = decLedgerPostingId2;
                infoLedgerPosting.VoucherNo = strVoucherNo;
                infoLedgerPosting.InvoiceNo = txtvoucherNo.Text.Trim();
                infoLedgerPosting.Date = PublicVariables._dtCurrentDate;
                infoLedgerPosting.LedgerId = 6;
                infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
                infoLedgerPosting.Debit = 0;
                infoLedgerPosting.Credit = Convert.ToDecimal(txtAmount.Text.ToString());
                infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate;
                infoLedgerPosting.ChequeDate = Convert.ToDateTime(txtChequeDate.Text);
                infoLedgerPosting.ChequeNo = txtcheckNo.Text.Trim();
                infoLedgerPosting.Extra1 = string.Empty;
                infoLedgerPosting.Extra2 = string.Empty;
                SpLedgerPosting.LedgerPostingEdit(infoLedgerPosting);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PP15:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #22
0
        /// <summary>
        /// On double clicking the cell in grid, it loads the corresponding Voucher to update or delete the entries
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvBillAllocation_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    decVoucherTypeId = Convert.ToDecimal(dgvBillAllocation.CurrentRow.Cells["voucherTypeId"].Value.ToString());

                    strTypeOfVoucher = dgvBillAllocation.CurrentRow.Cells["typeOfVoucher"].Value.ToString();
                    strVoucherNo     = dgvBillAllocation.CurrentRow.Cells["voucherNo"].Value.ToString();
                    if (strTypeOfVoucher == "PDC Payable")
                    {
                        PDCPayableMasterSP sp          = new PDCPayableMasterSP();
                        decimal            decMasterId = sp.PdcPayableMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmPdcPayable frmpdcPayableObj = new frmPdcPayable();
                        frmpdcPayableObj = Application.OpenForms["frmPdcPayable"] as frmPdcPayable;

                        if (frmpdcPayableObj == null)
                        {
                            frmpdcPayableObj           = new frmPdcPayable();
                            frmpdcPayableObj.MdiParent = formMDI.MDIObj;

                            frmpdcPayableObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "PDC Receivable")
                    {
                        PDCReceivableMasterSP sp = new PDCReceivableMasterSP();
                        decimal decMasterId      = sp.PdcReceivableMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmPdcReceivable frmPdcReceivableObj = new frmPdcReceivable();
                        frmPdcReceivableObj = Application.OpenForms["frmPdcReceivable"] as frmPdcReceivable;
                        if (frmPdcReceivableObj == null)
                        {
                            frmPdcReceivableObj           = new frmPdcReceivable();
                            frmPdcReceivableObj.MdiParent = formMDI.MDIObj;
                            frmPdcReceivableObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Payment Voucher")
                    {
                        PaymentMasterSP sp          = new PaymentMasterSP();
                        decimal         decMasterId = sp.paymentMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmPaymentVoucher frmPaymentVoucherObj = new frmPaymentVoucher();
                        frmPaymentVoucherObj = Application.OpenForms["frmPaymentVoucher"] as frmPaymentVoucher;
                        if (frmPaymentVoucherObj == null)
                        {
                            frmPaymentVoucherObj           = new frmPaymentVoucher();
                            frmPaymentVoucherObj.MdiParent = formMDI.MDIObj;

                            frmPaymentVoucherObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Receipt Voucher")
                    {
                        ReceiptMasterSP sp          = new ReceiptMasterSP();
                        decimal         decMasterId = sp.ReceiptMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmReceiptVoucher frmReceiptVoucherObj = new frmReceiptVoucher();
                        frmReceiptVoucherObj = Application.OpenForms["frmReceiptVoucher"] as frmReceiptVoucher;
                        if (frmReceiptVoucherObj == null)
                        {
                            frmReceiptVoucherObj           = new frmReceiptVoucher();
                            frmReceiptVoucherObj.MdiParent = formMDI.MDIObj;

                            frmReceiptVoucherObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Journal Voucher")
                    {
                        JournalMasterSP sp          = new JournalMasterSP();
                        decimal         decMasterId = sp.JournalMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmJournalVoucher frmJournalVoucherObj = new frmJournalVoucher();
                        frmJournalVoucherObj = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
                        if (frmJournalVoucherObj == null)
                        {
                            frmJournalVoucherObj           = new frmJournalVoucher();
                            frmJournalVoucherObj.MdiParent = formMDI.MDIObj;

                            frmJournalVoucherObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Credit Note")
                    {
                        CreditNoteMasterSP sp          = new CreditNoteMasterSP();
                        decimal            decMasterId = sp.CreditNoteMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmCreditNote frmCreditNoteObj = new frmCreditNote();
                        frmCreditNoteObj = Application.OpenForms["frmCreditNote"] as frmCreditNote;
                        if (frmCreditNoteObj == null)
                        {
                            frmCreditNoteObj           = new frmCreditNote();
                            frmCreditNoteObj.MdiParent = formMDI.MDIObj;

                            frmCreditNoteObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                    if (strTypeOfVoucher == "Debit Note")
                    {
                        DebitNoteMasterSP sp          = new DebitNoteMasterSP();
                        decimal           decMasterId = sp.DebitNoteMasterIdView(decVoucherTypeId, strVoucherNo);

                        frmDebitNote frmDebitNoteObj = new frmDebitNote();
                        frmDebitNoteObj = Application.OpenForms["frmDebitNote"] as frmDebitNote;
                        if (frmDebitNoteObj == null)
                        {
                            frmDebitNoteObj           = new frmDebitNote();
                            frmDebitNoteObj.MdiParent = formMDI.MDIObj;

                            frmDebitNoteObj.CallFromBillAllocation(this, decMasterId);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "BA15:" + ex.Message;
            }
        }
Пример #23
0
 /// <summary>
 /// Delete button click, check the user privilage, references and call the delete function
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         PDCPayableMasterSP sppdcpayable = new PDCPayableMasterSP();
         if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnDelete.Text))
         {
             if (PublicVariables.isMessageDelete)
             {
                 if (Messages.DeleteMessage())
                 {
                     if (isInEditMode && sppdcpayable.PDCPayableReferenceCheck(decPDCpayableEditId, decPDCpayableVoucherTypeId))
                     {
                         Messages.ReferenceExistsMessage();
                     }
                     else
                     {
                         DeleteFunction(decPDCpayableEditId);
                         txtvoucherNo.Focus();
                     }
                 }
             }
             else
             {
                 if (isInEditMode && sppdcpayable.PDCPayableReferenceCheck(decPDCpayableEditId, decPDCpayableVoucherTypeId))
                 {
                     Messages.ReferenceExistsMessage();
                 }
                 DeleteFunction(decPDCpayableEditId);
                 txtvoucherNo.Focus();
             }
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PP40:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #24
0
 /// <summary>
 /// Fill function for updation
 /// </summary>
 public void FillFunction()
 {
     try
     {
         PDCPayableMasterInfo infopdcpayable = new PDCPayableMasterInfo();
         PDCPayableMasterSP spPdcpayable = new PDCPayableMasterSP();
         infopdcpayable = spPdcpayable.PDCPayableMasterView(decPDCpayableEditId);
         txtvoucherNo.ReadOnly = false;
         strVoucherNo = infopdcpayable.VoucherNo;
         strInvoiceNo = infopdcpayable.InvoiceNo;
         txtvoucherNo.Text = strInvoiceNo;
         decSufixprefixPdcpayableID = infopdcpayable.SuffixPrefixId;
         decPDCpayableVoucherTypeId = infopdcpayable.VoucherTypeId;
         VoucherTypeSP spVoucherType = new VoucherTypeSP();
         isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decPDCpayableVoucherTypeId);
         if (isAutomatic)
         {
             txtvoucherNo.ReadOnly = true;
         }
         else
         {
             txtvoucherNo.ReadOnly = false;
         }
         if (infopdcpayable.PdcPayableMasterId != 0)
         {
             txtvoucherNo.Text = infopdcpayable.InvoiceNo;
             dtpVoucherDate.Value = infopdcpayable.Date;
             txtVoucherDate.Text = dtpVoucherDate.Value.ToString("dd-MMM-yyyy");
             txtNarration.Text = infopdcpayable.Narration;
             cmbAccountLedger.SelectedValue = infopdcpayable.LedgerId;
             txtAmount.Text = infopdcpayable.Amount.ToString();
             if (infopdcpayable.BankId != 0)
                 cmbBank.SelectedValue = infopdcpayable.BankId;
             else
                 cmbBank.SelectedValue = string.Empty;
             txtcheckNo.Text = infopdcpayable.ChequeNo;
             txtChequeDate.Text = infopdcpayable.ChequeDate.ToString("dd-MMM-yyyy");
             btnSave.Text = "Update";
             PartyBalanceSP SpPartyBalance = new PartyBalanceSP();
             DataTable dtbl1 = new DataTable();
             dtbl1 = SpPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decPDCpayableVoucherTypeId, strVoucherNo, infopdcpayable.Date);
             dtblPartyBalance = dtbl1;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PP22:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #25
0
 /// <summary>
 /// Print function
 /// </summary>
 /// <param name="decMasterId"></param>
 public void Print(decimal decMasterId)
 {
     try
     {
         DataSet dsPdcPayable = new DataSet();
         PDCPayableMasterSP Sppdcpayable = new PDCPayableMasterSP();
         dsPdcPayable = Sppdcpayable.PDCpayableVoucherPrinting(decMasterId, 1);
         frmReport frmreport = new frmReport();
         frmreport.MdiParent = formMDI.MDIObj;
         frmreport.PDCpayableReportPrinting(dsPdcPayable);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PP8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #26
0
 /// <summary>
 /// Function to search the details
 /// </summary>
 public void Search()
 {
     try
     {
         if (cmbAccountLedger.Text.Trim() == string.Empty)
         {
             cmbAccountLedger.Text = "All";
         }
         else if (cmbVoucherType.Text.Trim() == string.Empty)
         {
             cmbVoucherType.Text = "All";
         }
         else if (cmbStatus.Text.Trim() == string.Empty)
         {
             cmbStatus.Text = "All";
         }
         DataTable dtblPDCReport = new DataTable();
         PDCPayableMasterSP sppdcpayable = new PDCPayableMasterSP();
         dtblPDCReport = sppdcpayable.PdcPayableReportSearch(Convert.ToDateTime(dtpFrmDate.Value.ToString()), Convert.ToDateTime(dtpTodate.Value.ToString()), cmbVoucherType.Text.ToString(), cmbAccountLedger.Text.ToString(), Convert.ToDateTime(dtpCheckDateFrom.Value.ToString()), Convert.ToDateTime(dtpCheckdateTo.Value.ToString()), txtcheckNo.Text.Trim(), txtVoucherNo.Text.Trim(), cmbStatus.Text.Trim());
         dgvPDCPayableReport.DataSource = dtblPDCReport;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PPREP5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #27
0
 /// <summary>
 /// Voucher no generation function based on the settings
 /// </summary>
 public void VoucherNumberGeneration()
 {
     try
     {
         if (isAutomatic == true)
         {
             TransactionsGeneralFill obj = new TransactionsGeneralFill();
             PDCPayableMasterSP spPdcpayable = new PDCPayableMasterSP();
             if (strVoucherNo == string.Empty)
             {
                 strVoucherNo = "0";
             }
             strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPDCpayableVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, strtableName);
             if (Convert.ToDecimal(strVoucherNo) != spPdcpayable.PDCPayableMaxUnderVoucherTypePlusOne(decPDCpayableVoucherTypeId) + 1)
             {
                 strVoucherNo = spPdcpayable.PDCPayableMaxUnderVoucherTypePlusOne(decPDCpayableVoucherTypeId).ToString();
                 strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPDCpayableVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, strtableName);
                 if (spPdcpayable.PDCPayableMaxUnderVoucherTypePlusOne(decPDCpayableVoucherTypeId) == 0)
                 {
                     strVoucherNo = "0";
                     strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPDCpayableVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, strtableName);
                 }
             }
             SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP();
             SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo();
             infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decPDCpayableVoucherTypeId, dtpVoucherDate.Value);
             strPrefix = infoSuffixPrefix.Prefix;
             strSuffix = infoSuffixPrefix.Suffix;
             decSufixprefixPdcpayableID = infoSuffixPrefix.SuffixprefixId;
             strInvoiceNo = strPrefix + strVoucherNo + strSuffix;
             txtvoucherNo.Text = strInvoiceNo;
             txtvoucherNo.ReadOnly = true;
         }
         else
         {
             txtvoucherNo.ReadOnly = false;
             txtvoucherNo.Text = string.Empty;
             lblVoucherNoManualValidator.Visible = true;
             strInvoiceNo = txtvoucherNo.Text.Trim();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PP3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #28
0
 /// <summary>
 /// When doubleclicking on the grid
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvReport_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     decimal decVouchertypeId = 0;
     string strVoucherNo = string.Empty;
     try
     {
         if (dgvReport.CurrentRow.Index == e.RowIndex)
         {
             if ((dgvReport.CurrentRow.Cells["voucherTypeId"].Value != null && dgvReport.CurrentRow.Cells["voucherTypeId"].Value.ToString() != string.Empty))
             {
                 int inI = dgvReport.CurrentCell.RowIndex;
                 foreach (DataGridViewRow dgv in dgvReport.Rows)
                 {
                     if (dgv.Cells["VoucherNo"].Value != null && dgv.Cells["VoucherNo"].Value.ToString() != string.Empty &&
                            dgv.Cells["voucherTypeId"].Value != null && dgv.Cells["voucherTypeId"].Value.ToString() != string.Empty)
                     {
                         strVoucherType = dgv.Cells["VoucherType"].Value.ToString();
                         decVouchertypeId = Convert.ToDecimal(dgv.Cells["voucherTypeId"].Value.ToString());
                         strVoucherNo = dgv.Cells["VoucherNo"].Value.ToString();
                     }
                     else
                     {
                         if (dgv.Cells["ledgerId"].Value.ToString() != string.Empty)
                         {
                             decledgerId = decimal.Parse(dgv.Cells["ledgerId"].Value.ToString());
                             strVoucherType = dgv.Cells["Account Ledger"].Value.ToString();
                             frmLedgerDetails frmLedger = new frmLedgerDetails();
                             frmLedger = Application.OpenForms["frmLedgerDetails"] as frmLedgerDetails;
                             if (frmLedger == null)
                             {
                                 frmLedger = new frmLedgerDetails();
                                 frmLedger.MdiParent = formMDI.MDIObj;
                                 frmLedger.callFromAgeing(this, decledgerId);
                                 this.Enabled = false;
                             }
                         }
                     }
                     if (dgv.Index == inI)
                     {
                         break;
                     }
                 }
                 if (strVoucherType == "Payment Voucher")
                 {
                     PaymentMasterSP spPaymentMaster = new PaymentMasterSP();
                     decMasterId = spPaymentMaster.paymentMasterIdView(decVouchertypeId, strVoucherNo);
                     frmPaymentVoucher frmPaymentVoucher = new frmPaymentVoucher();
                     frmPaymentVoucher = Application.OpenForms["frmPaymentVoucher"] as frmPaymentVoucher;
                     if (frmPaymentVoucher == null)
                     {
                         frmPaymentVoucher = new frmPaymentVoucher();
                         frmPaymentVoucher.MdiParent = formMDI.MDIObj;
                         frmPaymentVoucher.callFromAgeing(this, decMasterId);
                         this.Enabled = false;
                     }
                 }
                 else if (strVoucherType == "Receipt Voucher")
                 {
                     ReceiptMasterSP spRecieptMaster = new ReceiptMasterSP();
                     decMasterId = spRecieptMaster.ReceiptMasterIdView(decVouchertypeId, strVoucherNo);
                     frmReceiptVoucher frmReceiptVoucher = new frmReceiptVoucher();
                     frmReceiptVoucher = Application.OpenForms["frmReceiptVoucher"] as frmReceiptVoucher;
                     if (frmReceiptVoucher == null)
                     {
                         frmReceiptVoucher = new frmReceiptVoucher();
                         frmReceiptVoucher.MdiParent = formMDI.MDIObj;
                         frmReceiptVoucher.callFromAgeing(this, decMasterId);
                         this.Enabled = false;
                     }
                 }
                 else if (strVoucherType == "Journal Voucher")
                 {
                     JournalMasterSP spJournalMaster = new JournalMasterSP();
                     decMasterId = spJournalMaster.JournalMasterIdView(decVouchertypeId, strVoucherNo);
                     frmJournalVoucher frmJournalVoucher = new frmJournalVoucher();
                     frmJournalVoucher = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher;
                     if (frmJournalVoucher == null)
                     {
                         frmJournalVoucher = new frmJournalVoucher();
                         frmJournalVoucher.MdiParent = formMDI.MDIObj;
                         frmJournalVoucher.callFromAgeing(this, decMasterId);
                         this.Enabled = false;
                     }
                 }
                 else if (strVoucherType == "PDC Receivable")
                 {
                     PDCReceivableMasterSP spPdcRecievabl = new PDCReceivableMasterSP();
                     decMasterId = spPdcRecievabl.PdcReceivableMasterIdView(decVouchertypeId, strVoucherNo);
                     frmPdcReceivable frmPdcReceivable = new frmPdcReceivable();
                     frmPdcReceivable = Application.OpenForms["frmPdcReceivable"] as frmPdcReceivable;
                     if (frmPdcReceivable == null)
                     {
                         frmPdcReceivable = new frmPdcReceivable();
                         frmPdcReceivable.MdiParent = formMDI.MDIObj;
                         frmPdcReceivable.callFromAgeing(this, decMasterId);
                         this.Enabled = false;
                     }
                 }
                 else if (strVoucherType == "PDC Payable")
                 {
                     PDCPayableMasterSP spPdcPayable = new PDCPayableMasterSP();
                     decMasterId = spPdcPayable.PdcPayableMasterIdView(decVouchertypeId, strVoucherNo);
                     frmPdcPayable frmPdcPayable = new frmPdcPayable();
                     frmPdcPayable = Application.OpenForms["frmPdcPayable"] as frmPdcPayable;
                     if (frmPdcPayable == null)
                     {
                         frmPdcPayable = new frmPdcPayable();
                         frmPdcPayable.MdiParent = formMDI.MDIObj;
                         frmPdcPayable.callFromAgeing(this, decMasterId);
                         this.Enabled = false;
                     }
                 }
                 else if (strVoucherType == "Sales Invoice")
                 {
                     SalesMasterSP spMaster = new SalesMasterSP();
                     decMasterId = spMaster.SalesMasterIdViewByvoucherNoAndVoucherType(decVouchertypeId, strVoucherNo);
                     SalesMasterSP spSalesMaster = new SalesMasterSP();
                     bool blPOS = spSalesMaster.DayBookSalesInvoiceOrPOS(decMasterId, decVouchertypeId);
                     frmSalesInvoice frmSalesInvoice = new frmSalesInvoice();
                     frmPOS frmPOS = new frmPOS();
                     if (blPOS == true)
                     {
                         frmPOS = Application.OpenForms["frmPOS"] as frmPOS;
                         if (frmPOS == null)
                         {
                             frmPOS = new frmPOS();
                             frmPOS.MdiParent = formMDI.MDIObj;
                             frmPOS.callFromAgeing(this, decMasterId);
                             this.Enabled = false;
                         }
                     }
                     else
                     {
                         frmSalesInvoice = Application.OpenForms["frmSalesInvoice"] as frmSalesInvoice;
                         if (frmSalesInvoice == null)
                         {
                             frmSalesInvoice = new frmSalesInvoice();
                             frmSalesInvoice.MdiParent = formMDI.MDIObj;
                             frmSalesInvoice.callFromAgeing(this, decMasterId);
                             this.Enabled = false;
                         }
                     }
                 }
                 else if (strVoucherType == "Purchase Invoice")
                 {
                     PurchaseMasterSP spPurchaseMaster = new PurchaseMasterSP();
                     decMasterId = spPurchaseMaster.PurchaseMasterIdViewByvoucherNoAndVoucherType(decVouchertypeId, strVoucherNo);
                     frmPurchaseInvoice objpurchase = new frmPurchaseInvoice();
                     objpurchase.WindowState = FormWindowState.Normal;
                     objpurchase.MdiParent = formMDI.MDIObj;
                     objpurchase.callFromAgeing(this, decMasterId);
                     this.Enabled = false;
                 }
                 else if (strVoucherType == "Credit Note")
                 {
                     CreditNoteMasterSP spCreditNoteMaster = new CreditNoteMasterSP();
                     decMasterId = spCreditNoteMaster.CreditNoteMasterIdView(decVouchertypeId, strVoucherNo);
                     frmCreditNote objpurchase = new frmCreditNote();
                     objpurchase.WindowState = FormWindowState.Normal;
                     objpurchase.MdiParent = formMDI.MDIObj;
                     objpurchase.callFromAgeing(this, decMasterId);
                     this.Enabled = false;
                 }
                 else if (strVoucherType == "Debit Note")
                 {
                     DebitNoteMasterSP spDebitNote = new DebitNoteMasterSP();
                     decMasterId = spDebitNote.DebitNoteMasterIdView(decVouchertypeId, strVoucherNo);
                     frmDebitNote objpurchase = new frmDebitNote();
                     objpurchase.WindowState = FormWindowState.Normal;
                     objpurchase.MdiParent = formMDI.MDIObj;
                     objpurchase.callFromAgeing(this, decMasterId);
                     this.Enabled = false;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AR17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #29
0
 /// <summary>
 /// Function to fill Bank combobox
 /// </summary>
 public void cmbBankAccountFill()
 {
     try
     {
         PDCPayableMasterSP sppdcpayble = new PDCPayableMasterSP();
         cmbBank.DataSource = null;
         DataTable dtblBank = sppdcpayble.BankAccountComboFill();
         DataRow dr = dtblBank.NewRow();
         dr["ledgerId"] = 0;
         dr["ledgerName"] = "All";
         dtblBank.Rows.InsertAt(dr, 0);
         cmbBank.DataSource = dtblBank;
         cmbBank.DisplayMember = "ledgerName";
         cmbBank.ValueMember = "ledgerId";
         cmbBank.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PCREG3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }