Exemplo n.º 1
0
        /// <summary>
        /// Function to Update values in ReceiptMaster Table
        /// </summary>
        /// <param name="receiptmasterinfo"></param>
        /// <returns></returns>
        public decimal ReceiptMasterEdit(ReceiptMasterInfo receiptmasterinfo)
        {
            decimal decRecieptMasterId = 0;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("ReceiptMasterEdit", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam          = sccmd.Parameters.Add("@receiptMasterId", SqlDbType.Decimal);
                sprmparam.Value    = receiptmasterinfo.ReceiptMasterId;
                sprmparam          = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
                sprmparam.Value    = receiptmasterinfo.VoucherNo;
                sprmparam          = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
                sprmparam.Value    = receiptmasterinfo.InvoiceNo;
                sprmparam          = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
                sprmparam.Value    = receiptmasterinfo.SuffixPrefixId;
                sprmparam          = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
                sprmparam.Value    = receiptmasterinfo.Date;
                sprmparam          = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
                sprmparam.Value    = receiptmasterinfo.LedgerId;
                sprmparam          = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
                sprmparam.Value    = receiptmasterinfo.TotalAmount;
                sprmparam          = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value    = receiptmasterinfo.Narration;
                sprmparam          = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
                sprmparam.Value    = receiptmasterinfo.VoucherTypeId;
                sprmparam          = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
                sprmparam.Value    = receiptmasterinfo.UserId;
                sprmparam          = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
                sprmparam.Value    = receiptmasterinfo.FinancialYearId;
                sprmparam          = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
                sprmparam.Value    = receiptmasterinfo.ExtraDate;
                sprmparam          = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value    = receiptmasterinfo.Extra1;
                sprmparam          = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value    = receiptmasterinfo.Extra2;
                decRecieptMasterId = Convert.ToDecimal(sccmd.ExecuteNonQuery().ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(decRecieptMasterId);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Function to Update values in ReceiptMaster Table
 /// </summary>
 /// <param name="receiptmasterinfo"></param>
 /// <returns></returns>
 public decimal ReceiptMasterEdit(ReceiptMasterInfo receiptmasterinfo)
 {
     decimal decRecieptMasterId = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ReceiptMasterEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@receiptMasterId", SqlDbType.Decimal);
         sprmparam.Value = receiptmasterinfo.ReceiptMasterId;
         sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = receiptmasterinfo.VoucherNo;
         sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = receiptmasterinfo.InvoiceNo;
         sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = receiptmasterinfo.SuffixPrefixId;
         sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = receiptmasterinfo.Date;
         sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
         sprmparam.Value = receiptmasterinfo.LedgerId;
         sprmparam = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = receiptmasterinfo.TotalAmount;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = receiptmasterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = receiptmasterinfo.VoucherTypeId;
         sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
         sprmparam.Value = receiptmasterinfo.UserId;
         sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = receiptmasterinfo.FinancialYearId;
         sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = receiptmasterinfo.ExtraDate;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = receiptmasterinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = receiptmasterinfo.Extra2;
         decRecieptMasterId = Convert.ToDecimal(sccmd.ExecuteNonQuery().ToString());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decRecieptMasterId;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Function to get particular values from ReceiptMaster table based on the parameter
        /// </summary>
        /// <param name="receiptMasterId"></param>
        /// <returns></returns>
        public ReceiptMasterInfo ReceiptMasterView(decimal receiptMasterId)
        {
            ReceiptMasterInfo receiptmasterinfo = new ReceiptMasterInfo();
            SqlDataReader     sdrreader         = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("ReceiptMasterView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@receiptMasterId", SqlDbType.Decimal);
                sprmparam.Value = receiptMasterId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    receiptmasterinfo.ReceiptMasterId = decimal.Parse(sdrreader[0].ToString());
                    receiptmasterinfo.VoucherNo       = sdrreader[1].ToString();
                    receiptmasterinfo.InvoiceNo       = sdrreader[2].ToString();
                    receiptmasterinfo.SuffixPrefixId  = decimal.Parse(sdrreader[3].ToString());
                    receiptmasterinfo.Date            = DateTime.Parse(sdrreader[4].ToString());
                    receiptmasterinfo.LedgerId        = decimal.Parse(sdrreader[5].ToString());
                    receiptmasterinfo.TotalAmount     = decimal.Parse(sdrreader[6].ToString());
                    receiptmasterinfo.Narration       = sdrreader[7].ToString();
                    receiptmasterinfo.VoucherTypeId   = decimal.Parse(sdrreader[8].ToString());
                    receiptmasterinfo.UserId          = decimal.Parse(sdrreader[9].ToString());
                    receiptmasterinfo.FinancialYearId = decimal.Parse(sdrreader[10].ToString());
                    receiptmasterinfo.ExtraDate       = DateTime.Parse(sdrreader[11].ToString());
                    receiptmasterinfo.Extra1          = sdrreader[12].ToString();
                    receiptmasterinfo.Extra2          = sdrreader[13].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(receiptmasterinfo);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Function to get particular values from eceiptMaster table based on the parameter
        /// </summary>
        /// <param name="decReceiptMastertId"></param>
        /// <returns></returns>
        public ReceiptMasterInfo ReceiptMasterViewByMasterId(decimal decReceiptMastertId)
        {
            ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo();
            SqlDataReader     sdrreader         = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("ReceiptMasterViewByMasterId", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@receiptMasterId", SqlDbType.Decimal);
                sprmparam.Value = decReceiptMastertId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    InfoReceiptMaster.VoucherNo       = sdrreader["voucherNo"].ToString();
                    InfoReceiptMaster.InvoiceNo       = sdrreader["invoiceNo"].ToString();
                    InfoReceiptMaster.SuffixPrefixId  = decimal.Parse(sdrreader["suffixprefixId"].ToString());
                    InfoReceiptMaster.Date            = DateTime.Parse(sdrreader["date"].ToString());
                    InfoReceiptMaster.LedgerId        = decimal.Parse(sdrreader["ledgerId"].ToString());
                    InfoReceiptMaster.TotalAmount     = decimal.Parse(sdrreader["totalAmount"].ToString());
                    InfoReceiptMaster.Narration       = sdrreader["narration"].ToString();
                    InfoReceiptMaster.VoucherTypeId   = decimal.Parse(sdrreader["voucherTypeId"].ToString());
                    InfoReceiptMaster.UserId          = decimal.Parse(sdrreader["userId"].ToString());
                    InfoReceiptMaster.FinancialYearId = decimal.Parse(sdrreader["financialYearId"].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(InfoReceiptMaster);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Function to fill datagridview
 /// </summary>
 public void gridfill()
 {
     try
     {
         ReceiptMasterSP   SpReceiptMaster   = new ReceiptMasterSP();
         ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo();
         DataTable         dtbl = new DataTable();
         if (cmbAccountLedger.SelectedValue.ToString() != "System.Data.DataRowView")
         {
             if (txtFromDate.Text.Trim() != string.Empty && txtToDate.Text.Trim() != string.Empty)
             {
                 dtbl = SpReceiptMaster.ReceiptMasterSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), Convert.ToDecimal(cmbAccountLedger.SelectedValue), txtVoucherNo.Text);
                 dgvReceiptRegister.DataSource = dtbl;
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "RR4:" + ex.Message;
     }
 }
 /// <summary>
 /// Function to fill datagridview
 /// </summary>
 public void gridfill()
 {
     try
     {
         ReceiptMasterSP   SpReceiptMaster   = new ReceiptMasterSP();
         ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo();
         DataTable         dtbl = new DataTable();
         if (cmbAccountLedger.SelectedValue.ToString() != "System.Data.DataRowView")
         {
             if (txtFromDate.Text.Trim() != string.Empty && txtToDate.Text.Trim() != string.Empty)
             {
                 dtbl = SpReceiptMaster.ReceiptMasterSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), Convert.ToDecimal(cmbAccountLedger.SelectedValue), txtVoucherNo.Text);
                 dgvReceiptRegister.DataSource = dtbl;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("RR4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// Function to fill datagridview
 /// </summary>
 public void gridfill()
 {
     try
     {
         ReceiptMasterSP SpReceiptMaster = new ReceiptMasterSP();
         ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo();
         DataTable dtbl = new DataTable();
         if (cmbAccountLedger.SelectedValue.ToString() != "System.Data.DataRowView")
         {
             if (txtFromDate.Text.Trim() != string.Empty && txtToDate.Text.Trim() != string.Empty)
             {
                 dtbl = SpReceiptMaster.ReceiptMasterSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), Convert.ToDecimal(cmbAccountLedger.SelectedValue), txtVoucherNo.Text);
                 dgvReceiptRegister.DataSource = dtbl;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("RR4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// Function to get particular values from eceiptMaster table based on the parameter
 /// </summary>
 /// <param name="decReceiptMastertId"></param>
 /// <returns></returns>
 public ReceiptMasterInfo ReceiptMasterViewByMasterId(decimal decReceiptMastertId)
 {
     ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ReceiptMasterViewByMasterId", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@receiptMasterId", SqlDbType.Decimal);
         sprmparam.Value = decReceiptMastertId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             InfoReceiptMaster.VoucherNo = sdrreader["voucherNo"].ToString();
             InfoReceiptMaster.InvoiceNo = sdrreader["invoiceNo"].ToString();
             InfoReceiptMaster.SuffixPrefixId = decimal.Parse(sdrreader["suffixprefixId"].ToString());
             InfoReceiptMaster.Date = DateTime.Parse(sdrreader["date"].ToString());
             InfoReceiptMaster.LedgerId = decimal.Parse(sdrreader["ledgerId"].ToString());
             InfoReceiptMaster.TotalAmount = decimal.Parse(sdrreader["totalAmount"].ToString());
             InfoReceiptMaster.Narration = sdrreader["narration"].ToString();
             InfoReceiptMaster.VoucherTypeId = decimal.Parse(sdrreader["voucherTypeId"].ToString());
             InfoReceiptMaster.UserId = decimal.Parse(sdrreader["userId"].ToString());
             InfoReceiptMaster.FinancialYearId = decimal.Parse(sdrreader["financialYearId"].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return InfoReceiptMaster;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Function to get particular values from ReceiptMaster table based on the parameter
 /// </summary>
 /// <param name="receiptMasterId"></param>
 /// <returns></returns>
 public ReceiptMasterInfo ReceiptMasterView(decimal receiptMasterId)
 {
     ReceiptMasterInfo receiptmasterinfo = new ReceiptMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ReceiptMasterView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@receiptMasterId", SqlDbType.Decimal);
         sprmparam.Value = receiptMasterId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             receiptmasterinfo.ReceiptMasterId = decimal.Parse(sdrreader[0].ToString());
             receiptmasterinfo.VoucherNo = sdrreader[1].ToString();
             receiptmasterinfo.InvoiceNo = sdrreader[2].ToString();
             receiptmasterinfo.SuffixPrefixId = decimal.Parse(sdrreader[3].ToString());
             receiptmasterinfo.Date = DateTime.Parse(sdrreader[4].ToString());
             receiptmasterinfo.LedgerId = decimal.Parse(sdrreader[5].ToString());
             receiptmasterinfo.TotalAmount = decimal.Parse(sdrreader[6].ToString());
             receiptmasterinfo.Narration = sdrreader[7].ToString();
             receiptmasterinfo.VoucherTypeId = decimal.Parse(sdrreader[8].ToString());
             receiptmasterinfo.UserId = decimal.Parse(sdrreader[9].ToString());
             receiptmasterinfo.FinancialYearId = decimal.Parse(sdrreader[10].ToString());
             receiptmasterinfo.ExtraDate = DateTime.Parse(sdrreader[11].ToString());
             receiptmasterinfo.Extra1 = sdrreader[12].ToString();
             receiptmasterinfo.Extra2 = sdrreader[13].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return receiptmasterinfo;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Edit function
 /// </summary>
 /// <param name="decMasterId"></param>
 public void Edit(decimal decMasterId)
 {
     try
     {
         int inRowCount = dgvReceiptVoucher.RowCount;
         int inTableRowCount = dtblPartyBalance.Rows.Count;
         int inB = 0;
         ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo();
         ReceiptMasterSP SpReceiptMaster = new ReceiptMasterSP();
         ReceiptDetailsInfo InfoReceiptDetails = new ReceiptDetailsInfo();
         ReceiptDetailsSP SpReceiptDetails = new ReceiptDetailsSP();
         LedgerPostingSP SpLedgerPosting = new LedgerPostingSP();
         LedgerPostingInfo InfoLegerPosting = new LedgerPostingInfo();
         PartyBalanceInfo InfopartyBalance = new PartyBalanceInfo();
         PartyBalanceSP SpPartyBalance = new PartyBalanceSP();
         BankReconciliationSP SpBankReconcilation = new BankReconciliationSP();
         InfoReceiptMaster.Date = dtpDate.Value;
         InfoReceiptMaster.ReceiptMasterId = decMasterId;
         InfoReceiptMaster.Extra1 = string.Empty;
         InfoReceiptMaster.Extra2 = string.Empty;
         InfoReceiptMaster.ExtraDate = DateTime.Now;
         InfoReceiptMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
         InfoReceiptMaster.LedgerId = Convert.ToDecimal(cmbCashOrBank.SelectedValue.ToString());
         InfoReceiptMaster.Narration = txtNarration.Text.Trim();
         decimal decTotalAmount = TotalAmountCalculation();
         InfoReceiptMaster.TotalAmount = decTotalAmount;
         InfoReceiptMaster.UserId = PublicVariables._decCurrentUserId;
         if (!isAutomatic)
         {
             InfoReceiptMaster.VoucherNo = txtVoucherNo.Text.Trim();
             InfoReceiptMaster.InvoiceNo = txtVoucherNo.Text.Trim();
             InfoReceiptMaster.SuffixPrefixId = 0;
         }
         else
         {
             InfoReceiptMaster.VoucherNo = strVoucherNo;
             InfoReceiptMaster.InvoiceNo = strInvoiceNo;
             InfoReceiptMaster.SuffixPrefixId = decDailySuffixPrefixId;
         }
         InfoReceiptMaster.VoucherTypeId = decReceiptVoucherTypeId;
         decimal decEffectRow = SpReceiptMaster.ReceiptMasterEdit(InfoReceiptMaster);
         if (decEffectRow != 0)
         {
             MasterLedgerPostingEdit();
         }
         foreach (object obj in arrlstOfRemove)
         {
             string str = Convert.ToString(obj);
             SpReceiptDetails.ReceiptDetailsDelete(Convert.ToDecimal(str));
             SpLedgerPosting.LedgerPostDeleteByDetailsId(Convert.ToDecimal(str), strVoucherNo, decReceiptVoucherTypeId);
         }
         decimal decReceiptDetailsId1 = 0;
         SpLedgerPosting.LedgerPostingDeleteByVoucherNoVoucherTypeIdAndLedgerId(strVoucherNo, decReceiptVoucherTypeId, 12);
         for (int inI = 0; inI < inRowCount - 1; inI++)
         {
             InfoReceiptDetails.Amount = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].Value.ToString());
             InfoReceiptDetails.ExchangeRateId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value.ToString());
             InfoReceiptDetails.Extra1 = string.Empty;
             InfoReceiptDetails.Extra2 = string.Empty;
             InfoReceiptDetails.ReceiptMasterId = InfoReceiptMaster.ReceiptMasterId;
             if (dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value != null && dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty)
             {
                 InfoReceiptDetails.LedgerId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString());
             }
             if (dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value != null && dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value.ToString() != string.Empty)
             {
                 InfoReceiptDetails.ChequeNo = dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value.ToString();
                 if (dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value != null && dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value.ToString() != string.Empty)
                 {
                     InfoReceiptDetails.ChequeDate = Convert.ToDateTime(dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value);
                 }
                 else
                 {
                     InfoReceiptDetails.ChequeDate = DateTime.Now;
                 }
             }
             else
             {
                 InfoReceiptDetails.ChequeNo = string.Empty;
                 InfoReceiptDetails.ChequeDate = DateTime.Now;
             }
             if (dgvReceiptVoucher.Rows[inI].Cells["dgvtxtReceiptDetailsId"].Value == null || dgvReceiptVoucher.Rows[inI].Cells["dgvtxtReceiptDetailsId"].Value.ToString() == string.Empty)//if new rows are added
             {
                 if (dgvReceiptVoucher.Rows[inI].HeaderCell.Value.ToString() != "X")
                 {
                     decimal decReceiptDetailsId = SpReceiptDetails.ReceiptDetailsAdd(InfoReceiptDetails);
                     if (decReceiptDetailsId != 0)
                     {
                         for (int inJ = 0; inJ < inTableRowCount; inJ++)
                         {
                             if (dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() == dtblPartyBalance.Rows[inJ]["LedgerId"].ToString())
                             {
                                 PartyBalanceAddOrEdit(inJ);
                             }
                         }
                         inB++;
                         DetailsLedgerPosting(inI, decReceiptDetailsId);
                     }
                 }
             }
             else
             {
                 if (dgvReceiptVoucher.Rows[inI].HeaderCell.Value.ToString() != "X")
                 {
                     InfoReceiptDetails.ReceiptDetailsId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvtxtreceiptDetailsId"].Value.ToString());
                     decimal decReceiptDetailsId = SpReceiptDetails.ReceiptDetailsEdit(InfoReceiptDetails);
                     if (decReceiptDetailsId != 0)
                     {
                         for (int inJ = 0; inJ < inTableRowCount; inJ++)
                         {
                             if (dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() == dtblPartyBalance.Rows[inJ]["LedgerId"].ToString())
                             {
                                 PartyBalanceAddOrEdit(inJ);
                             }
                         }
                         inB++;
                         decReceiptDetailsId = InfoReceiptDetails.ReceiptDetailsId;
                         decimal decLedgerPostId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value.ToString());
                         DetailsLedgerPostingEdit(inI, decLedgerPostId, decReceiptDetailsId1);
                     }
                 }
                 else
                 {
                     decimal decDetailsId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvtxtreceiptDetailsId"].Value.ToString());
                     SpReceiptDetails.ReceiptDetailsDelete(decDetailsId);
                     SpLedgerPosting.LedgerPostDeleteByDetailsId(decDetailsId, strVoucherNo, decReceiptVoucherTypeId);
                     for (int inJ = 0; inJ < dtblPartyBalance.Rows.Count; inJ++)
                     {
                         if (dtblPartyBalance.Rows.Count == inJ)
                         {
                             break;
                         }
                         if (dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value != null && dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty)
                         {
                             if (dtblPartyBalance.Rows[inJ]["LedgerId"].ToString() == dgvReceiptVoucher.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(InfoReceiptMaster.ReceiptMasterId);
             }
             else
             {
                 Print(InfoReceiptMaster.ReceiptMasterId);
             }
         }
         if (frmReceiptRegisterObj != null)
         {
             this.Close();
             frmReceiptRegisterObj.CallFromReceiptVoucher(this);
         }
         if (frmReceiptReportObj != null)
         {
             this.Close();
             frmReceiptReportObj.CallFromReceiptVoucher(this);
         }
         if (frmDayBookObj != null)
         {
             this.Close();
         }
         if (frmBillallocationObj != null)
         {
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("RV13:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// Save function
        /// </summary>
        public void Save()
        {
            try
            {
                int inGridRowCount = dgvReceiptVoucher.RowCount;
                int inTableRowCount = dtblPartyBalance.Rows.Count;
                int inB = 0;
                ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo();
                ReceiptMasterSP SpReceiptMaster = new ReceiptMasterSP();
                ReceiptDetailsInfo InfoReceiptDetails = new ReceiptDetailsInfo();
                ReceiptDetailsSP SpReceiptDetails = new ReceiptDetailsSP();
                PartyBalanceSP SpPartyBalance = new PartyBalanceSP();
                PartyBalanceInfo InfopartyBalance = new PartyBalanceInfo();
                InfoReceiptMaster.Date = dtpDate.Value;
                InfoReceiptMaster.Extra1 = string.Empty;
                InfoReceiptMaster.Extra2 = string.Empty;
                InfoReceiptMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
                InfoReceiptMaster.LedgerId = Convert.ToDecimal(cmbCashOrBank.SelectedValue.ToString());
                InfoReceiptMaster.Narration = txtNarration.Text;
                decimal decTotalAmount = TotalAmountCalculation();
                InfoReceiptMaster.TotalAmount = decTotalAmount;
                InfoReceiptMaster.UserId = PublicVariables._decCurrentUserId;
                if (!isAutomatic)
                {
                    InfoReceiptMaster.VoucherNo = txtVoucherNo.Text.Trim();
                    InfoReceiptMaster.InvoiceNo = txtVoucherNo.Text.Trim();
                    InfoReceiptMaster.SuffixPrefixId = 0;
                }
                else
                {
                    InfoReceiptMaster.VoucherNo = strVoucherNo;
                    InfoReceiptMaster.InvoiceNo = strInvoiceNo;
                    InfoReceiptMaster.SuffixPrefixId = decDailySuffixPrefixId;
                }
                InfoReceiptMaster.VoucherTypeId = decReceiptVoucherTypeId;
                decimal decReceiptMasterId = SpReceiptMaster.ReceiptMasterAdd(InfoReceiptMaster);
                if (decReceiptMasterId != 0)
                {
                    MasterLedgerPosting();
                }
                for (int inI = 0; inI < inGridRowCount - 1; inI++)
                {
                    if (dgvReceiptVoucher.Rows[inI].HeaderCell.Value.ToString() != "X")
                    {
                        InfoReceiptDetails.Amount = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].Value.ToString());
                        InfoReceiptDetails.ExchangeRateId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value.ToString());
                        InfoReceiptDetails.Extra1 = string.Empty;
                        InfoReceiptDetails.Extra2 = string.Empty;
                        InfoReceiptDetails.LedgerId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString());
                        InfoReceiptDetails.ReceiptMasterId = decReceiptMasterId;
                        if (dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value != null && dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty)
                        {
                            InfoReceiptDetails.LedgerId = Convert.ToDecimal(dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString());
                        }
                        if (dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value != null && dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value.ToString() != string.Empty)
                        {
                            InfoReceiptDetails.ChequeNo = dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value.ToString();
                            if (dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value != null && dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value.ToString() != string.Empty)
                            {
                                InfoReceiptDetails.ChequeDate = Convert.ToDateTime(dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value);
                            }
                            else
                            {
                                InfoReceiptDetails.ChequeDate = DateTime.Now;
                            }
                        }
                        else
                        {
                            InfoReceiptDetails.ChequeNo = string.Empty;
                            InfoReceiptDetails.ChequeDate = DateTime.Now;
                        }
                        decimal decReceiptDetailsId = SpReceiptDetails.ReceiptDetailsAdd(InfoReceiptDetails);
                        if (decReceiptDetailsId != 0)
                        {
                            for (int inJ = 0; inJ < inTableRowCount; inJ++)
                            {
                                if (dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() == dtblPartyBalance.Rows[inJ]["LedgerId"].ToString())
                                {
                                    PartyBalanceAddOrEdit(inJ);
                                }
                            }
                            inB++;
                            DetailsLedgerPosting(inI, decReceiptDetailsId);
                        }
                    }
                }

                Messages.SavedMessage();
                if (cbxPrintafterSave.Checked)
                {
                    if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                    {
                        PrintForDotMatrix(decReceiptMasterId);
                    }
                    else
                    {
                        Print(decReceiptMasterId);
                    }
                }
                Clear();
            }
            catch (Exception ex)
            {
                MessageBox.Show("RV12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 12
0
 /// <summary>
 /// Fill function for updation
 /// </summary>
 public void FillFunction()
 {
     try
     {
         isValueChange = false;
         ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo();
         ReceiptMasterSP SpReceiptMaster = new ReceiptMasterSP();
         ReceiptDetailsInfo InfoReceiptDetails = new ReceiptDetailsInfo();
         ReceiptDetailsSP SpReceiptDetails = new ReceiptDetailsSP();
         PartyBalanceSP SpPartyBalance = new PartyBalanceSP();
         LedgerPostingSP SpLedgerPosting = new LedgerPostingSP();
         VoucherTypeSP SpVoucherType = new VoucherTypeSP();
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         AccountLedgerSP SpAccountLedger = new AccountLedgerSP();
         InfoReceiptMaster = SpReceiptMaster.ReceiptMasterViewByMasterId(decRecieptmasterId);
         isAutomatic = SpVoucherType.CheckMethodOfVoucherNumbering(InfoReceiptMaster.VoucherTypeId);
         if (isAutomatic)
         {
             txtVoucherNo.ReadOnly = true;
             txtVoucherNo.Text = InfoReceiptMaster.InvoiceNo;
         }
         else
         {
             txtVoucherNo.ReadOnly = false;
             txtVoucherNo.Text = InfoReceiptMaster.VoucherNo;
         }
         dtpDate.Value = InfoReceiptMaster.Date;
         cmbCashOrBank.SelectedValue = InfoReceiptMaster.LedgerId;
         txtNarration.Text = InfoReceiptMaster.Narration;
         txtTotal.Text = InfoReceiptMaster.TotalAmount.ToString();
         decDailySuffixPrefixId = InfoReceiptMaster.SuffixPrefixId;
         decReceiptVoucherTypeId = InfoReceiptMaster.VoucherTypeId;
         strVoucherNo = InfoReceiptMaster.VoucherNo;
         strInvoiceNo = InfoReceiptMaster.InvoiceNo;
         DataTable dtbl = new DataTable();
         dtbl = SpReceiptDetails.ReceiptDetailsViewByMasterId(decRecieptmasterId);
         for (int inI = 0; inI < dtbl.Rows.Count; inI++)
         {
             dgvReceiptVoucher.Rows.Add();
             dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString());
             dgvReceiptVoucher.Rows[inI].Cells["dgvtxtreceiptMasterId"].Value = dtbl.Rows[inI]["receiptMasterId"].ToString();
             dgvReceiptVoucher.Rows[inI].Cells["dgvtxtreceiptDetailsId"].Value = dtbl.Rows[inI]["receiptDetailsId"].ToString();
             dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = dtbl.Rows[inI]["amount"].ToString();
             dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(dtbl.Rows[inI]["exchangeRateId"].ToString());
             decimal decDetailsId1 = Convert.ToDecimal(dtbl.Rows[inI]["receiptDetailsId"].ToString());
             decimal decLedgerPostingId = SpLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, decReceiptVoucherTypeId);
             dgvReceiptVoucher.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(dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].FormattedValue.ToString()));
             if (decI > 0)
             {
                 dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].ReadOnly = true;
                 dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].ReadOnly = true;
             }
             else
             {
                 dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].ReadOnly = false;
                 dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].ReadOnly = false;
             }
             if (dtbl.Rows[inI]["chequeNo"].ToString() != string.Empty)
             {
                 dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value = dtbl.Rows[inI]["chequeNo"].ToString();
                 dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value = Convert.ToDateTime(dtbl.Rows[inI]["chequeDate"].ToString()).ToString("dd-MMM-yyyy");
             }
             dgvReceiptVoucher.Rows[inI].HeaderCell.Value = string.Empty;
         }
         DataTable dtbl1 = new DataTable();
         dtbl1 = SpPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decReceiptVoucherTypeId, strVoucherNo, InfoReceiptMaster.Date);
         dtblPartyBalance = dtbl1;
         isValueChange = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("RV34:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }