Пример #1
0
 public void Print()
 {
     try
     {
         PaymentMasterSP SpPaymentMaster = new PaymentMasterSP();
         DataSet         dsPaymentReport = SpPaymentMaster.PaymentReportPrinting(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), Convert.ToDecimal(cmbLedger.SelectedValue), Convert.ToDecimal(cmbVoucherType.SelectedValue), Convert.ToDecimal(cmbBankOrCash.SelectedValue), 1);
         frmReport       frmReport       = new frmReport();
         frmReport.MdiParent = formMDI.MDIObj;
         frmReport.PaymentReportPrinting(dsPaymentReport);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PRP1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #2
0
 public void Print()
 {
     try
     {
         PaymentMasterSP SpPaymentMaster = new PaymentMasterSP();
         DataSet dsPaymentReport = SpPaymentMaster.PaymentReportPrinting(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), Convert.ToDecimal(cmbLedger.SelectedValue), Convert.ToDecimal(cmbVoucherType.SelectedValue), Convert.ToDecimal(cmbBankOrCash.SelectedValue), 1);
         frmReport frmReport = new frmReport();
         frmReport.MdiParent = formMDI.MDIObj;
         frmReport.PaymentReportPrinting(dsPaymentReport);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PRP1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #3
0
 public void Print()
 {
     try
     {
         PaymentMasterSP SpPaymentMaster = new PaymentMasterSP();
         DataSet         dsPaymentReport = SpPaymentMaster.PaymentReportPrinting(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), Convert.ToDecimal(cmbLedger.SelectedValue), Convert.ToDecimal(cmbVoucherType.SelectedValue), Convert.ToDecimal(cmbBankOrCash.SelectedValue), 1);
         frmReport       frmReport       = new frmReport();
         frmReport.MdiParent = formMDI.MDIObj;
         frmReport.PaymentReportPrinting(dsPaymentReport);
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PREP1:" + ex.Message;
     }
 }
Пример #4
0
 /// <summary>
 /// Function to fill the grid based on the search catogeries
 /// </summary>
 public void GridFill()
 {
     try
     {
         PaymentMasterSP SpPaymentMaster = new PaymentMasterSP();
         DataTable       dtbl            = new DataTable();
         if (cmbLedger.Items.Count != 0 && cmbVoucherType.Items.Count != 0 && cmbBankOrCash.Items.Count != 0)
         {
             if ((cmbLedger.SelectedValue.ToString() != "System.Data.DataRowView") && (cmbVoucherType.SelectedValue.ToString() != "System.Data.DataRowView") && (cmbBankOrCash.SelectedValue.ToString() != "System.Data.DataRowView"))
             {
                 if (txtFromDate.Text.Trim() != string.Empty && txtToDate.Text.Trim() != string.Empty)
                 {
                     dtbl = SpPaymentMaster.PaymentReportSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), Convert.ToDecimal(cmbLedger.SelectedValue), Convert.ToDecimal(cmbVoucherType.SelectedValue), Convert.ToDecimal(cmbBankOrCash.SelectedValue));
                     dgvPaymentReport.DataSource = dtbl;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PREP5:" + ex.Message;
     }
 }
Пример #5
0
 /// <summary>
 /// Function to fill the grid based on the search catogeries
 /// </summary>
 public void GridFill()
 {
     try
     {
         PaymentMasterSP SpPaymentMaster = new PaymentMasterSP();
         DataTable       dtbl            = new DataTable();
         if (cmbLedger.Items.Count != 0 && cmbVoucherType.Items.Count != 0 && cmbBankOrCash.Items.Count != 0)
         {
             if ((cmbLedger.SelectedValue.ToString() != "System.Data.DataRowView") && (cmbVoucherType.SelectedValue.ToString() != "System.Data.DataRowView") && (cmbBankOrCash.SelectedValue.ToString() != "System.Data.DataRowView"))
             {
                 if (txtFromDate.Text.Trim() != string.Empty && txtToDate.Text.Trim() != string.Empty)
                 {
                     dtbl = SpPaymentMaster.PaymentReportSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), Convert.ToDecimal(cmbLedger.SelectedValue), Convert.ToDecimal(cmbVoucherType.SelectedValue), Convert.ToDecimal(cmbBankOrCash.SelectedValue));
                     dgvPaymentReport.DataSource = dtbl;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PRP5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #6
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void gridfill()
 {
     try
     {
         PaymentMasterSP   SpPaymentMaster   = new PaymentMasterSP();
         PaymentMasterInfo infoPaymentMaster = new PaymentMasterInfo();
         DataTable         dtbl = new DataTable();
         if (cmbAccountLedger.Items.Count > 0)
         {
             if (cmbAccountLedger.SelectedValue.ToString() != "System.Data.DataRowView")
             {
                 if (txtFromDate.Text.Trim() != string.Empty && txtToDate.Text.Trim() != string.Empty)
                 {
                     dtbl = SpPaymentMaster.PaymentMasterSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), Convert.ToDecimal(cmbAccountLedger.SelectedValue), txtVoucherNo.Text);
                     dgvPaymentRegister.DataSource = dtbl;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PREG4:" + ex.Message;
     }
 }
Пример #7
0
        /// <summary>
        /// Edit Function
        /// </summary>
        /// <param name="decMasterId"></param>
        public void Edit(decimal decMasterId)
        {
            try
            {
                int inRowCount = dgvPaymentVoucher.RowCount;
                int inTableRowCount = dtblPartyBalance.Rows.Count;
                int inB = 0;
                PaymentMasterInfo InfoPaymentMaster = new PaymentMasterInfo();
                PaymentMasterSP SpPaymentMaster = new PaymentMasterSP();
                PaymentDetailsInfo InfoPaymentDetails = new PaymentDetailsInfo();
                PaymentDetailsSP SpPaymentDetails = new PaymentDetailsSP();
                LedgerPostingSP SpLedgerPosting = new LedgerPostingSP();
                LedgerPostingInfo InfoLegerPosting = new LedgerPostingInfo();
                PartyBalanceInfo InfopartyBalance = new PartyBalanceInfo();
                PartyBalanceSP SpPartyBalance = new PartyBalanceSP();
                BankReconciliationSP SpBankReconcilation = new BankReconciliationSP();
                InfoPaymentMaster.Date = dtpDate.Value;
                InfoPaymentMaster.PaymentMasterId = decMasterId;
                InfoPaymentMaster.Extra1 = string.Empty;
                InfoPaymentMaster.Extra2 = string.Empty;
                InfoPaymentMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
                InfoPaymentMaster.InvoiceNo = txtVoucherNo.Text.Trim();
                InfoPaymentMaster.LedgerId = Convert.ToDecimal(cmbBankorCash.SelectedValue.ToString());
                InfoPaymentMaster.Narration = txtNarration.Text.Trim();
                InfoPaymentMaster.SuffixPrefixId = decDailySuffixPrefixId;
                decimal decTotalAmount = TotalAmountCalculation();
                InfoPaymentMaster.TotalAmount = decTotalAmount;
                InfoPaymentMaster.UserId = PublicVariables._decCurrentUserId;

                InfoPaymentMaster.VoucherNo = strVoucherNo;

                InfoPaymentMaster.VoucherTypeId = decPaymentVoucherTypeId;
                decimal decPaymentMasterId = SpPaymentMaster.PaymentMasterEdit(InfoPaymentMaster);
                if (decPaymentmasterId != 0)
                {
                    MasterLedgerPostingEdit();
                }
                foreach (object obj in arrlstOfRemove)
                {
                    string str = Convert.ToString(obj);
                    SpPaymentDetails.PaymentDetailsDelete(Convert.ToDecimal(str));
                    SpLedgerPosting.LedgerPostDeleteByDetailsId(Convert.ToDecimal(str), strVoucherNo, decPaymentVoucherTypeId);
                }
                SpLedgerPosting.LedgerPostingDeleteByVoucherNoVoucherTypeIdAndLedgerId(strVoucherNo, decPaymentVoucherTypeId, 12);
                decimal decPaymentDetailsId1 = 0;
                for (int inI = 0; inI < inRowCount - 1; inI++)
                {
                    InfoPaymentDetails.Amount = Convert.ToDecimal(dgvPaymentVoucher.Rows[inI].Cells["dgvtxtAmount"].Value.ToString());
                    InfoPaymentDetails.ExchangeRateId = Convert.ToDecimal(dgvPaymentVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value.ToString());
                    InfoPaymentDetails.Extra1 = string.Empty;
                    InfoPaymentDetails.Extra2 = string.Empty;
                    if (dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value != null && dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty)
                    {
                        InfoPaymentDetails.LedgerId = Convert.ToDecimal(dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString());
                    }
                    if (dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value != null && dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value.ToString() != string.Empty)
                    {
                        InfoPaymentDetails.ChequeNo = dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value.ToString();
                        if (dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value != null && dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value.ToString() != string.Empty)
                        {
                            InfoPaymentDetails.ChequeDate = Convert.ToDateTime(dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value);
                        }
                        else
                        {
                            InfoPaymentDetails.ChequeDate = DateTime.Now;
                        }
                    }
                    else
                    {
                        InfoPaymentDetails.ChequeNo = string.Empty;
                        InfoPaymentDetails.ChequeDate = DateTime.Now;
                    }
                    InfoPaymentDetails.PaymentMasterId = decPaymentMasterId;
                    if (dgvPaymentVoucher.Rows[inI].Cells["dgvtxtpaymentDetailsId"].FormattedValue.ToString() == "0")//if new rows are added
                    {
                        if (dgvPaymentVoucher.Rows[inI].HeaderCell.Value.ToString() != "X")//add new rows added which are completed
                        {
                            decimal decPaymentDetailsId = SpPaymentDetails.PaymentDetailsAdd(InfoPaymentDetails);//to add new rows in payment details
                            if (decPaymentDetailsId != 0)
                            {
                                for (int inJ = 0; inJ < inTableRowCount; inJ++)
                                {
                                    if (dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() == dtblPartyBalance.Rows[inJ]["LedgerId"].ToString())
                                    {
                                        PartyBalanceAddOrEdit(inJ);
                                    }
                                }
                                inB++;
                                DetailsLedgerPosting(inI, decPaymentDetailsId);//to add new ledger posting
                            }
                        }
                    }
                    else
                    {
                        if (dgvPaymentVoucher.Rows[inI].HeaderCell.Value.ToString() != "X")//add new rows updated which are completed
                        {
                            InfoPaymentDetails.PaymentDetailsId = Convert.ToDecimal(dgvPaymentVoucher.Rows[inI].Cells["dgvtxtpaymentDetailsId"].Value.ToString());
                            decimal decPaymentDetailsId = SpPaymentDetails.PaymentDetailsEdit(InfoPaymentDetails);//to edit rows
                            if (decPaymentDetailsId != 0)
                            {
                                for (int inJ = 0; inJ < inTableRowCount; inJ++)
                                {
                                    if (dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() == dtblPartyBalance.Rows[inJ]["LedgerId"].ToString())
                                    {
                                        PartyBalanceAddOrEdit(inJ);
                                    }
                                }
                                inB++;
                                decPaymentDetailsId1 = InfoPaymentDetails.PaymentDetailsId;
                                decimal decLedgerPostId = Convert.ToDecimal(dgvPaymentVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value.ToString());
                                DetailsLedgerPostingEdit(inI, decLedgerPostId, decPaymentDetailsId1);
                            }
                        }
                        else
                        {
                            decimal decDetailsId = Convert.ToDecimal(dgvPaymentVoucher.Rows[inI].Cells["dgvtxtpaymentDetailsId"].Value.ToString());
                            SpPaymentDetails.PaymentDetailsDelete(decDetailsId);
                            SpLedgerPosting.LedgerPostDeleteByDetailsId(decDetailsId, strVoucherNo, decPaymentVoucherTypeId);
                            for (int inJ = 0; inJ < dtblPartyBalance.Rows.Count; inJ++)
                            {
                                if (dtblPartyBalance.Rows.Count == inJ)
                                {
                                    break;
                                }
                                if (dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value != null && dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty)
                                {
                                    if (dtblPartyBalance.Rows[inJ]["LedgerId"].ToString() == dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString())
                                    {
                                        if (dtblPartyBalance.Rows[inJ]["PartyBalanceId"].ToString() != "0")
                                        {
                                            arrlstOfDeletedPartyBalanceRow.Add(dtblPartyBalance.Rows[inJ]["PartyBalanceId"]);
                                        }
                                    }
                                }
                            }
                        }
                    }

                }
                DeletePartyBalanceOfRemovedRow();
                isUpdated = true;
                Messages.UpdatedMessage();
                if (cbxPrintafterSave.Checked)
                {
                    if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                    {
                        PrintForDotMatrix(decPaymentmasterId);
                    }
                    else
                    {
                        Print(decPaymentMasterId);
                    }
                }
                if (frmPaymentRegisterObj != null)
                {
                    this.Close();
                    frmPaymentRegisterObj.CallFromPaymentVoucher(this);
                }
                if (frmPaymentReportObj != null)
                {
                    this.Close();
                    frmPaymentReportObj.CallFromPaymentVoucher(this);
                }
                if (frmDayBookObj != null)
                {
                    this.Close();
                }
                if (frmBillallocationObj != null)
                {
                    this.Close();
                }
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("PV18:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #8
0
        /// <summary>
        /// Save Function
        /// </summary>
        public void Save()
        {
            try
            {
                int inGridRowCount = dgvPaymentVoucher.RowCount;
                int inTableRowCount = dtblPartyBalance.Rows.Count;
                int inB = 0;
                PaymentMasterInfo InfoPaymentMaster = new PaymentMasterInfo();
                PaymentMasterSP SpPaymentMaster = new PaymentMasterSP();
                PaymentDetailsInfo InfoPaymentDetails = new PaymentDetailsInfo();
                PaymentDetailsSP SpPaymentDetails = new PaymentDetailsSP();
                PartyBalanceSP SpPartyBalance = new PartyBalanceSP();
                PartyBalanceInfo InfopartyBalance = new PartyBalanceInfo();
                DateValidation objVal = new DateValidation();
                TextBox txtDate1 = new TextBox();
                InfoPaymentMaster.Date = dtpDate.Value;
                InfoPaymentMaster.Extra1 = string.Empty;
                InfoPaymentMaster.Extra2 = string.Empty;
                InfoPaymentMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
                InfoPaymentMaster.InvoiceNo = txtVoucherNo.Text.Trim(); ;
                InfoPaymentMaster.LedgerId = Convert.ToDecimal(cmbBankorCash.SelectedValue.ToString());
                InfoPaymentMaster.Narration = txtNarration.Text.Trim();
                InfoPaymentMaster.SuffixPrefixId = decDailySuffixPrefixId;
                decimal decTotalAmount = TotalAmountCalculation();
                InfoPaymentMaster.TotalAmount = decTotalAmount;
                InfoPaymentMaster.UserId = PublicVariables._decCurrentUserId;
                InfoPaymentMaster.VoucherNo = strVoucherNo;
                InfoPaymentMaster.VoucherTypeId = decPaymentVoucherTypeId;
                decimal decPaymentMasterId = SpPaymentMaster.PaymentMasterAdd(InfoPaymentMaster);
                if (decPaymentMasterId != 0)
                {
                    MasterLedgerPosting();
                }
                for (int inI = 0; inI < inGridRowCount - 1; inI++)
                {
                    if (dgvPaymentVoucher.Rows[inI].HeaderCell.Value.ToString() != "X")
                    {
                        InfoPaymentDetails.Amount = Convert.ToDecimal(dgvPaymentVoucher.Rows[inI].Cells["dgvtxtAmount"].Value.ToString());
                        InfoPaymentDetails.ExchangeRateId = Convert.ToDecimal(dgvPaymentVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value.ToString());
                        InfoPaymentDetails.Extra1 = string.Empty;
                        InfoPaymentDetails.Extra2 = string.Empty;
                        InfoPaymentDetails.LedgerId = Convert.ToDecimal(dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString());
                        InfoPaymentDetails.PaymentMasterId = decPaymentMasterId;
                        if (dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value != null && dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty)
                        {
                            InfoPaymentDetails.LedgerId = Convert.ToDecimal(dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString());
                        }
                        if (dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value != null && dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value.ToString() != string.Empty)
                        {
                            InfoPaymentDetails.ChequeNo = dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value.ToString();

                            if (dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value != null && dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value.ToString() != string.Empty)
                            {
                                InfoPaymentDetails.ChequeDate = Convert.ToDateTime(dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value);
                            }
                            else
                            {
                                InfoPaymentDetails.ChequeDate = DateTime.Now;
                            }
                        }
                        else
                        {
                            InfoPaymentDetails.ChequeNo = string.Empty;
                            InfoPaymentDetails.ChequeDate = DateTime.Now;
                        }
                        decimal decPaymentDetailsId = SpPaymentDetails.PaymentDetailsAdd(InfoPaymentDetails);
                        if (decPaymentDetailsId != 0)
                        {
                            for (int inJ = 0; inJ < inTableRowCount; inJ++)
                            {
                                if (dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() == dtblPartyBalance.Rows[inJ]["LedgerId"].ToString())
                                {
                                    PartyBalanceAddOrEdit(inJ);
                                }
                            }
                            inB++;
                            DetailsLedgerPosting(inI, decPaymentDetailsId);
                        }
                    }
                }
                Messages.SavedMessage();
                if (cbxPrintafterSave.Checked)
                {
                    if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                    {
                        PrintForDotMatrix(decPaymentmasterId);
                    }
                    else
                    {
                        Print(decPaymentMasterId);
                    }
                }
                Clear();
            }
            catch (Exception ex)
            {
                MessageBox.Show("PV17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #9
0
        /// <summary>
        /// Save or edit function, checking invalid entries to save or update
        /// </summary>
        public void SaveOrEdit()
        {
            try
            {
                PaymentMasterSP SpPaymentMaster = new PaymentMasterSP();
                int inIfGridColumnMissing = 0;
                int inRowCount = dgvPaymentVoucher.RowCount;
                ArrayList arrLst = new ArrayList();
                string output = string.Empty;
                if (txtVoucherNo.Text == string.Empty)
                {
                    Messages.InformationMessage("Enter voucher number.");
                    txtVoucherNo.Focus();
                    inIfGridColumnMissing = 1;
                }
                else if (cmbBankorCash.SelectedIndex == -1)
                {
                    Messages.InformationMessage("Select any bank or cash");
                    cmbBankorCash.Focus();
                    inIfGridColumnMissing = 1;
                }
                else if (inRowCount == 1)
                {
                    Messages.InformationMessage("Can't save without atleast one complete details");
                    dgvPaymentVoucher.Focus();
                    inIfGridColumnMissing = 1;
                }
                else if (Convert.ToDecimal(txtTotal.Text) == 0)
                {
                    Messages.InformationMessage("Can't save the total amount as Zero");
                    dgvPaymentVoucher.Focus();
                }
                else
                {
                    int inJ = 0;
                    for (int inI = 0; inI < inRowCount - 1; inI++)
                    {

                        if (dgvPaymentVoucher.Rows[inI].HeaderCell.Value.ToString() == "X")
                        {
                            arrLst.Add(Convert.ToString(inI + 1));
                            inIfGridColumnMissing = 1;
                            inJ++;
                        }
                    }
                    if (inJ != 0)
                    {
                        if (inJ == inRowCount - 1)
                        {
                            Messages.InformationMessage("Can't save without atleat one complete details");
                            inIfGridColumnMissing = 1;
                        }
                        else
                        {
                            foreach (object obj in arrLst)
                            {
                                string str = Convert.ToString(obj);
                                if (str != null)
                                {
                                    output += str + ",";
                                }
                                else
                                {
                                    break;
                                }
                            }
                            bool isOk = Messages.UpdateMessageCustom("Row No " + output + " not completed.Do you want to continue?");
                            if (isOk)
                            {
                                inIfGridColumnMissing = 0;
                            }
                            else
                            {
                                inIfGridColumnMissing = 1;
                            }
                        }
                    }

                    if (inIfGridColumnMissing == 0)
                    {
                        if (btnSave.Text == "Save")
                        {
                            if (!isAutomatic)
                            {
                                if (SpPaymentMaster.PaymentVoucherCheckExistence(txtVoucherNo.Text.Trim(), decPaymentVoucherTypeId, 0))
                                {
                                    Messages.InformationMessage("Voucher number already exist");
                                }
                                else
                                {
                                    if (PublicVariables.isMessageAdd)
                                    {
                                        if (Messages.SaveMessage())
                                        {
                                            Save();
                                        }
                                    }
                                    else
                                    {
                                        Save();
                                    }
                                }
                            }
                            else
                            {
                                if (PublicVariables.isMessageAdd)
                                {
                                    if (Messages.SaveMessage())
                                    {
                                        Save();
                                    }
                                }
                                else
                                {
                                    Save();
                                }
                            }
                        }
                        else if (btnSave.Text == "Update")
                        {
                            if (!isAutomatic)
                            {
                                if (SpPaymentMaster.PaymentVoucherCheckExistence(txtVoucherNo.Text.Trim(), decPaymentVoucherTypeId, decPaymentmasterId))
                                {
                                    Messages.InformationMessage("Voucher number already exist");
                                }
                                else
                                {
                                    if (PublicVariables.isMessageEdit)
                                    {
                                        if (Messages.UpdateMessage())
                                        {
                                            Edit(decPaymentmasterId);
                                        }
                                    }
                                    else
                                    {
                                        Edit(decPaymentmasterId);
                                    }
                                }
                            }
                            else
                            {
                                if (PublicVariables.isMessageEdit)
                                {
                                    if (Messages.UpdateMessage())
                                    {
                                        Edit(decPaymentmasterId);
                                    }
                                }
                                else
                                {
                                    Edit(decPaymentmasterId);
                                }
                            }

                        }
                    }

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PV14:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #10
0
 /// <summary>
 /// Print function
 /// </summary>
 /// <param name="decPaymentMasterId"></param>
 public void Print(decimal decPaymentMasterId)
 {
     try
     {
         PaymentMasterSP SpPaymentMaster = new PaymentMasterSP();
         DataSet dsPaymentVoucher = SpPaymentMaster.PaymentVoucherPrinting(decPaymentMasterId, 1);
         frmReport frmReport = new frmReport();
         frmReport.MdiParent = formMDI.MDIObj;
         frmReport.PaymentVoucherPrinting(dsPaymentVoucher);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PV10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #11
0
        /// <summary>
        /// To reset the form here and Generate the voucher no generation
        /// </summary>
        public void Clear()
        {
            try
            {
                TransactionsGeneralFill obj = new TransactionsGeneralFill();
                if (btnSave.Text == "Update")
                {
                    if (frmPaymentRegisterObj != null)
                    {
                        frmPaymentRegisterObj.Close();
                    }
                }
                if (isAutomatic)
                {

                    SalaryVoucherMasterSP spMaster = new SalaryVoucherMasterSP();
                    PaymentMasterSP SpPaymentMaster = new PaymentMasterSP();
                    if (strVoucherNo == string.Empty)
                    {
                        strVoucherNo = "0";
                    }
                    strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName);
                    if (Convert.ToDecimal(strVoucherNo) != SpPaymentMaster.PaymentMasterMax(decPaymentVoucherTypeId) + 1)
                    {
                        strVoucherNo = SpPaymentMaster.PaymentMasterMax(decPaymentVoucherTypeId).ToString();
                        strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName);
                        if (SpPaymentMaster.PaymentMasterMax(decPaymentVoucherTypeId) == 0)
                        {
                            strVoucherNo = "0";
                            strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName);
                        }
                    }
                    SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP();
                    SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo();
                    infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decPaymentVoucherTypeId, dtpDate.Value);
                    strPrefix = infoSuffixPrefix.Prefix;
                    strSuffix = infoSuffixPrefix.Suffix;
                    strInvoiceNo = strPrefix + strVoucherNo + strSuffix;
                    txtVoucherNo.Text = strInvoiceNo;
                    txtVoucherNo.ReadOnly = true;
                }
                else
                {
                    txtVoucherNo.Text = string.Empty;
                    txtVoucherNo.ReadOnly = false;
                }
                dtpDate.MinDate = PublicVariables._dtFromDate;
                dtpDate.MaxDate = PublicVariables._dtToDate;
                dtpDate.Value = PublicVariables._dtCurrentDate;
                cmbBankorCash.SelectedIndex = -1;
                txtNarration.Text = string.Empty;
                txtTotal.Text = string.Empty;
                dgvPaymentVoucher.ClearSelection();
                dgvPaymentVoucher.Rows.Clear();
                btnSave.Text = "Save";
                btnDelete.Enabled = false;
                cbxPrintafterSave.Checked = false;
                dtblPartyBalance.Clear();
                if (isAutomatic)
                {
                    txtDate.Select();
                }
                else
                {
                    txtVoucherNo.Select();
                }
                PrintCheck();

            }
            catch (Exception ex)
            {
                MessageBox.Show("PV9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #12
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;
            }
        }
Пример #13
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void gridfill()
 {
     try
     {
         PaymentMasterSP SpPaymentMaster = new PaymentMasterSP();
         PaymentMasterInfo infoPaymentMaster = new PaymentMasterInfo();
         DataTable dtbl = new DataTable();
         if (cmbAccountLedger.Items.Count > 0)
         {
             if (cmbAccountLedger.SelectedValue.ToString() != "System.Data.DataRowView")
             {
                 if (txtFromDate.Text.Trim() != string.Empty && txtToDate.Text.Trim() != string.Empty)
                 {
                     dtbl = SpPaymentMaster.PaymentMasterSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), Convert.ToDecimal(cmbAccountLedger.SelectedValue), txtVoucherNo.Text);
                     dgvPaymentRegister.DataSource = dtbl;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PREG4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #14
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);
            }
        }
Пример #15
0
        /// <summary>
        /// Delete Function
        /// </summary>
        /// <param name="decMasterId"></param>
        public void Delete(decimal decMasterId)
        {
            try
            {
                PaymentMasterSP SpPaymentMaster = new PaymentMasterSP();
                PartyBalanceSP SpPartyBalance = new PartyBalanceSP();

                if (!SpPartyBalance.PartyBalanceCheckReference(decPaymentVoucherTypeId, strVoucherNo))
                {
                    SpPaymentMaster.PaymentVoucherDelete(decPaymentmasterId, decPaymentVoucherTypeId, strVoucherNo);
                    Messages.DeletedMessage();
                    if (frmPaymentRegisterObj != null)
                    {
                        this.Close();
                        frmPaymentRegisterObj.CallFromPaymentVoucher(this);
                    }
                    else if (frmPaymentReportObj != null)
                    {
                        this.Close();
                        frmPaymentReportObj.CallFromPaymentVoucher(this);
                    }
                    else if (frmLedgerDetailsObj != null)
                    {
                        this.Close();
                    }
                    if (_frmVoucherSearch != null)
                    {
                        this.Close();
                        _frmVoucherSearch.GridFill();
                    }
                    if (frmDayBookObj != null)
                    {
                        this.Close();
                    }
                    if (frmBillallocationObj != null)
                    {
                        this.Close();
                    }

                }
                else
                {
                    Messages.InformationMessage("Reference exist. Cannot delete");
                    txtDate.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PV19:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #16
0
 /// <summary>
 /// Function to fill the grid based on the search catogeries
 /// </summary>
 public void GridFill()
 {
     try
     {
         PaymentMasterSP SpPaymentMaster = new PaymentMasterSP();
         DataTable dtbl = new DataTable();
         if (cmbLedger.Items.Count != 0 && cmbVoucherType.Items.Count != 0 && cmbBankOrCash.Items.Count != 0)
         {
             if ((cmbLedger.SelectedValue.ToString() != "System.Data.DataRowView") && (cmbVoucherType.SelectedValue.ToString() != "System.Data.DataRowView" ) && (cmbBankOrCash.SelectedValue.ToString() != "System.Data.DataRowView"))
             {
                 if (txtFromDate.Text.Trim() != string.Empty && txtToDate.Text.Trim() != string.Empty)
                 {
                     dtbl = SpPaymentMaster.PaymentReportSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), Convert.ToDecimal(cmbLedger.SelectedValue), Convert.ToDecimal(cmbVoucherType.SelectedValue), Convert.ToDecimal(cmbBankOrCash.SelectedValue));
                     dgvPaymentReport.DataSource = dtbl;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PRP5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #17
0
        /// <summary>
        /// Grid Fill function while coming from other form to update or delete
        /// </summary>
        public void FillFunction()
        {
            try
            {
                PaymentMasterSP SpPaymentMaster = new PaymentMasterSP();
                PaymentMasterInfo InfoPaymentMaster = new PaymentMasterInfo();
                PaymentDetailsSP SpPaymentDetails = new PaymentDetailsSP();
                PartyBalanceSP SpPartyBalance = new PartyBalanceSP();
                LedgerPostingSP SpLedgerPosting = new LedgerPostingSP();
                VoucherTypeSP SpVoucherType = new VoucherTypeSP();
                AccountGroupSP spAccountGroup = new AccountGroupSP();
                AccountLedgerSP SpAccountLedger = new AccountLedgerSP();
                InfoPaymentMaster = SpPaymentMaster.PaymentMasterViewByMasterId(decPaymentmasterId);//view master details                    
                isAutomatic = SpVoucherType.CheckMethodOfVoucherNumbering(InfoPaymentMaster.VoucherTypeId);
                if (isAutomatic)
                {
                    txtVoucherNo.ReadOnly = true;
                    txtVoucherNo.Text = InfoPaymentMaster.InvoiceNo;
                    txtDate.Focus();
                }
                else
                {
                    txtVoucherNo.ReadOnly = false;
                    txtVoucherNo.Text = InfoPaymentMaster.InvoiceNo;
                    txtVoucherNo.Focus();
                }
                dtpDate.Text = InfoPaymentMaster.Date.ToString();
                cmbBankorCash.SelectedValue = InfoPaymentMaster.LedgerId;
                txtNarration.Text = InfoPaymentMaster.Narration;
                txtTotal.Text = InfoPaymentMaster.TotalAmount.ToString();
                decDailySuffixPrefixId = InfoPaymentMaster.SuffixPrefixId;
                decPaymentVoucherTypeId = InfoPaymentMaster.VoucherTypeId;
                strVoucherNo = InfoPaymentMaster.VoucherNo;
                strInvoiceNo = InfoPaymentMaster.InvoiceNo;
                DataTable dtbl = new DataTable();
                dtbl = SpPaymentDetails.PaymentDetailsViewByMasterId(decPaymentmasterId);//view details details
                for (int inI = 0; inI < dtbl.Rows.Count; inI++)
                {
                    dgvPaymentVoucher.Rows.Add();
                    dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString());
                    dgvPaymentVoucher.Rows[inI].Cells["dgvtxtpaymentMasterId"].Value = dtbl.Rows[inI]["paymentMasterId"].ToString();
                    dgvPaymentVoucher.Rows[inI].Cells["dgvtxtpaymentDetailsId"].Value = dtbl.Rows[inI]["paymentDetailsId"].ToString();
                    dgvPaymentVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = dtbl.Rows[inI]["amount"].ToString();
                    dgvPaymentVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(dtbl.Rows[inI]["exchangeRateId"].ToString());
                    decimal decDetailsId1 = Convert.ToDecimal(dtbl.Rows[inI]["paymentDetailsId"].ToString());
                    decimal decLedgerPostingId = SpLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, decPaymentVoucherTypeId);
                    dgvPaymentVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString();
                    decimal decLedgerId = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString());
                    bool IsBankAccount = spAccountGroup.AccountGroupwithLedgerId(decLedgerId);
                    decimal decI = Convert.ToDecimal(SpAccountLedger.AccountGroupIdCheck(dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].FormattedValue.ToString()));
                    if (decI > 0)//to make amount and currency read only when party is choosen as ledger
                    {
                        dgvPaymentVoucher.Rows[inI].Cells["dgvtxtAmount"].ReadOnly = true;
                        dgvPaymentVoucher.Rows[inI].Cells["dgvcmbCurrency"].ReadOnly = true;
                    }
                    else
                    {
                        dgvPaymentVoucher.Rows[inI].Cells["dgvtxtAmount"].ReadOnly = false;
                        dgvPaymentVoucher.Rows[inI].Cells["dgvcmbCurrency"].ReadOnly = false;
                    }
                    dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value = dtbl.Rows[inI]["ChequeNo"].ToString();
                    if (dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value != null && dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value.ToString() != string.Empty)
                    {
                        dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value = Convert.ToDateTime(dtbl.Rows[inI]["ChequeDate"].ToString()).ToString("dd-MMM-yyyy");
                    }
                }
                DataTable dtbl1 = new DataTable();
                dtbl1 = SpPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decPaymentVoucherTypeId, strVoucherNo, InfoPaymentMaster.Date);

                dtblPartyBalance = dtbl1;
            }
            catch (Exception ex)
            {
                MessageBox.Show("PV36:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #18
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);
     }
 }
Пример #19
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);
            }
        }