Exemplo n.º 1
0
 /// <summary>
 /// Function to fill the grid
 /// </summary>
 public void Gridfill()
 {
     try
     {
         DataTable dtbl = new DataTable();
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         if (cmbAccountGroup.Text.Trim() == string.Empty)
         {
             cmbAccountGroup.Text = "All";
         }
         if (txtMobile.Text.Trim() == string.Empty)
         {
             txtMobile.Text = "All";
         }
         if (txtPhone.Text.Trim() == string.Empty)
         {
             txtPhone.Text = "All";
         }
         if (txtEmail.Text.Trim() == string.Empty)
         {
             txtEmail.Text = "All";
         }
         if (txtLedgerName.Text.Trim() == string.Empty)
         {
             txtLedgerName.Text = "All";
         }
         if (txtMobile.Text == "All")
         {
             txtMobile.Text = string.Empty;
         }
         if (txtPhone.Text == "All")
         {
             txtPhone.Text = string.Empty;
         }
         if (txtEmail.Text == "All")
         {
             txtEmail.Text = string.Empty;
         }
         if (txtLedgerName.Text == "All")
         {
             txtLedgerName.Text = string.Empty;
         }
         dtbl = spAccountLedger.PartyAddressBookSearch(cmbAccountGroup.Text, txtMobile.Text, txtPhone.Text, txtEmail.Text, txtLedgerName.Text);
         dvgPartyAddressBook.DataSource = dtbl;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PAB:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Function to fill ledgers as TreeMode
 /// </summary>
 /// <param name="tn"></param>
 public void FillTree(TreeNode tn)
 {
     try
     {
         DataTable dtb = new DataTable();
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         dtb = spAccountGroup.AccountGroupViewAllByGroupUnder(Convert.ToDecimal(tn.Name));
         AccountLedgerSP ledgerSP = new AccountLedgerSP();
         if (dtb.Rows.Count > 0)
         {
             foreach (DataRow dr in dtb.Rows)
             {
                 tn.Nodes.Add(dr["accountGroupId"].ToString(), dr["accountGroupName"].ToString());
                 tn.ExpandAll();
                 if (tn.LastNode != null)
                 {
                     tn.LastNode.ForeColor = Color.Red;
                 }
                 else
                 {
                     tn.LastNode.ForeColor = Color.Blue;
                 }
             }
             foreach (TreeNode tn1 in tn.Nodes)
             {
                 FillTree(tn1);
                 DataTable dtb1 = ledgerSP.AccountLedgerViewAllByLedgerName(Convert.ToDecimal(tn1.Name));
                 foreach (DataRow dr in dtb1.Rows)
                 {
                     tn1.Nodes.Add(dr["ledgerId"].ToString(), dr["ledgerName"].ToString());
                     tn1.ExpandAll();
                     if (tn1.LastNode != null)
                     {
                         tn1.LastNode.ForeColor = Color.Blue;
                     }
                     else
                     {
                         tn.LastNode.ForeColor = Color.Red;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("COA:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// account group combo fill function
        /// </summary>
        public void cmbComboFill()
        {
            try
            {
                AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                DataTable dtblAccountLedger = new DataTable();
                dtblAccountLedger = spAccountLedger.MultipleAccountLedgerComboFill();
                cmbAccountGroup.DataSource = dtblAccountLedger;
                cmbAccountGroup.ValueMember = "accountGroupId";
                cmbAccountGroup.DisplayMember = "accountGroupName";
            }
            catch (Exception ex)
            {
                MessageBox.Show("MAL1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);

            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// BankAccount Combobox fill function
 /// </summary>
 public void bankAccountComboFill()
 {
     try
     {
         DataTable dtbl = new DataTable();
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         TransactionsGeneralFill obj = new TransactionsGeneralFill();
         dtbl = obj.BankComboFill();
         cmbBankAccount.DataSource = dtbl;
         cmbBankAccount.ValueMember = "ledgerId";
         cmbBankAccount.DisplayMember = "ledgerName";
         cmbBankAccount.SelectedIndex = -1;
     }
     catch (Exception ex)
     {
         MessageBox.Show("BR:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 /// <param name="decId1"></param>
 /// <param name="decId2"></param>
 public void GridFill(decimal decId1, decimal decId2)
 {
     try
     {
         DataTable dtbl = new DataTable();
         AccountLedgerSP spAccountledger = new AccountLedgerSP();
         if (cmbAccountGroup.Text == "ALL")
         {
             cmbAccountGroup.Text = "ALL";
         }
         dtbl = spAccountledger.LedgerPopupSearch(txtLedgerName.Text, cmbAccountGroup.Text, decId1, decId2);
         dgvLedgerPopup.DataSource = dtbl;
     }
     catch (Exception ex)
     {
         MessageBox.Show("LP1:" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Function to fill Area combo box
 /// </summary>
 public void AreaComboFill()
 {
     try
     {
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         DataTable dtbl = new DataTable();
         dtbl = spAccountLedger.cmbAreafillInCustomer();
         DataRow dr = dtbl.NewRow();
         dr["areaId"] = 0;
         dr["areaName"] = "All";
         dtbl.Rows.InsertAt(dr, 0);
         cmbArea.DataSource = dtbl;
         cmbArea.ValueMember = "areaId";
         cmbArea.DisplayMember = "areaName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("Cus1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// Function to fill AccountLedger combobox
 /// </summary>
 public void AccountLedgerComboFill()
 {
     try
     {
         DataTable dtbl = new DataTable();
         AccountLedgerSP spaccountledger = new AccountLedgerSP();
         dtbl = spaccountledger.AccountLedgerViewAll();
         DataRow dr = dtbl.NewRow();
         dr[0] = 0;
         dr[2] = "ALL";
         dtbl.Rows.InsertAt(dr, 0);
         cmbAccountLedger.DataSource = dtbl;
         cmbAccountLedger.ValueMember = "ledgerId";
         cmbAccountLedger.DisplayMember = "ledgerName";
         cmbAccountLedger.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("DRNTREP3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// dgvAdditionalCost grid cellbeginedit event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvAdditionalCost_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     try
     {
         DataTable dtbl = new DataTable();
         AccountLedgerSP SpAccountLedger = new AccountLedgerSP();
         if (dgvAdditionalCost.CurrentCell.ColumnIndex == dgvAdditionalCost.Columns["dgvcmbAdditionalCostLedger"].Index)
         {
             dtbl = SpAccountLedger.AdditionalCostGet();
             if (dtbl.Rows.Count > 0)
             {
                 if (dgvAdditionalCost.RowCount > 1)
                 {
                     int inGridRowCount = dgvAdditionalCost.RowCount;
                     for (int inI = 0; inI < inGridRowCount - 1; inI++)
                     {
                         if (inI != e.RowIndex)
                         {
                             int inTableRowcount = dtbl.Rows.Count;
                             for (int inJ = 0; inJ < inTableRowcount; inJ++)
                             {
                                 if (dgvAdditionalCost.Rows[inI].Cells["dgvcmbAdditionalCostLedger"].Value != null && dgvAdditionalCost.Rows[inI].Cells["dgvcmbAdditionalCostLedger"].Value.ToString() != string.Empty)
                                 {
                                     if (dtbl.Rows[inJ]["ledgerId"].ToString() == dgvAdditionalCost.Rows[inI].Cells["dgvcmbAdditionalCostLedger"].Value.ToString())
                                     {
                                         dtbl.Rows.RemoveAt(inJ);
                                         break;
                                     }
                                 }
                             }
                         }
                     }
                 }
                 DataGridViewComboBoxCell dgvcmbLedger = (DataGridViewComboBoxCell)dgvAdditionalCost[dgvAdditionalCost.Columns["dgvcmbAdditionalCostLedger"].Index, e.RowIndex];
                 dgvcmbLedger.DataSource = dtbl;
                 dgvcmbLedger.ValueMember = "ledgerId";
                 dgvcmbLedger.DisplayMember = "ledgerName";
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SJ:77" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// delete function
 /// </summary>
 public void Delete()
 {
     try
     {
         if (PublicVariables.isMessageDelete)
         {
             if (Messages.DeleteMessage())
             {
                 TaxInfo infoTax = new TaxInfo();
                 TaxSP spTax = new TaxSP();
                 TaxDetailsInfo infoTaxDetails = new TaxDetailsInfo();
                 TaxDetailsSP spTaxDetails = new TaxDetailsSP();
                 AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                 bool isExist = spTax.TaxReferenceCheck(decTaxId);
                 if (!isExist)
                 {
                     if ((spTax.TaxReferenceDelete(decTaxId,decLedgerId)) == -1)
                     {
                         Messages.ReferenceExistsMessage();
                     }
                     else
                     {
                         spTaxDetails.TaxDetailsDeleteWithTaxId(decTaxId);
                         spAccountLedger.AccountLedgerDelete(decLedgerId);
                         Messages.DeletedMessage();
                         TaxSearchGridFill();
                         TaxSelectionGridFill();
                         Clear();
                         SearchClear();
                     }
                 }
                 else
                 {
                     Messages.ReferenceExistsMessage();
                 }
             }
         }
         else
         {
             TaxInfo infoTax = new TaxInfo();
             TaxSP spTax = new TaxSP();
             TaxDetailsInfo infoTaxDetails = new TaxDetailsInfo();
             TaxDetailsSP spTaxDetails = new TaxDetailsSP();
             bool isExist = spTax.TaxReferenceCheck(decTaxId);
             if (!isExist)
             {
                 if ((spTax.TaxReferenceDelete(decTaxId,decLedgerId)) == -1)
                 {
                     Messages.ReferenceExistsMessage();
                 }
                 else
                 {
                     spTaxDetails.TaxDetailsDeleteWithTaxId(decTaxId);
                     Messages.DeletedMessage();
                     TaxSearchGridFill();
                     TaxSelectionGridFill();
                     Clear();
                     SearchClear();
                 }
             }
             else
             {
                 Messages.ReferenceExistsMessage();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("TC11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// checking checking existance entries for save or edit function
        /// </summary>
        public void SaveOrEditMessage()
        {
            try
            {
                //create ledger for the tax
                AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                string strTaxNameForLedger = string.Empty;
                strTaxNameForLedger = txtTaxName.Text;

                
                    if (btnSave.Text == "Save")
                    {
                        if (!spAccountLedger.AccountLedgerCheckExistence(strTaxNameForLedger, 0))
                        {
                            if (PublicVariables.isMessageAdd)
                            {
                                if (Messages.SaveMessage())
                                {

                                    SaveFunction();
                                    TaxSelectionGridFill();
                                    TaxSearchGridFill();
                                }
                            }
                            else
                            {
                                SaveFunction();
                                TaxSelectionGridFill();
                                TaxSearchGridFill();
                            }
                        }
                        else
                        {
                            Messages.InformationMessage("Cannot save. Ledger already exists");
                        }
                    }
                    else
                    {
                        if (!spAccountLedger.AccountLedgerCheckExistence(strTaxNameForLedger, decLedgerId))
                        {
                            if (PublicVariables.isMessageEdit)
                            {
                                if (Messages.UpdateMessage())
                                {
                                    EditFunction();
                                    TaxSelectionGridFill();
                                    TaxSearchGridFill();
                                }
                            }
                            else
                            {
                                EditFunction();
                                TaxSelectionGridFill();
                                TaxSearchGridFill();
                            }
                        }
                        else
                        {
                            Messages.InformationMessage("Cannot save. Ledger already exists");
                        }
                    }
                
            }
            catch (Exception ex)
            {
                MessageBox.Show("TC6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Cell click event for open Party balance form and calculate the settelment
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvPaymentVoucher_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex >= 0)
         {
             AccountLedgerSP SpAccountLedger = new AccountLedgerSP();
             if (dgvPaymentVoucher.CurrentCell.ColumnIndex == dgvPaymentVoucher.Columns["dgvbtnAgainst"].Index)
             {
                 decimal decI = Convert.ToDecimal(SpAccountLedger.AccountGroupIdCheck(dgvPaymentVoucher.CurrentRow.Cells["dgvcmbAccountLedger"].FormattedValue.ToString()));
                 if (decI > 0)
                 {
                     frmPartyBalanceObj = new frmPartyBalance();
                     frmPartyBalanceObj.MdiParent = formMDI.MDIObj;
                     decimal decLedgerId = Convert.ToDecimal(dgvPaymentVoucher.CurrentRow.Cells["dgvcmbAccountLedger"].Value.ToString());
                     if (!isAutomatic)
                     {
                         frmPartyBalanceObj.CallFromPaymentVoucher(this, decLedgerId, dtblPartyBalance, decPaymentVoucherTypeId, txtVoucherNo.Text, Convert.ToDateTime(txtDate.Text), arrlstOfDeletedPartyBalanceRow);
                     }
                     else
                     {
                         frmPartyBalanceObj.CallFromPaymentVoucher(this, decLedgerId, dtblPartyBalance, decPaymentVoucherTypeId, strVoucherNo, Convert.ToDateTime(txtDate.Text), arrlstOfDeletedPartyBalanceRow);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PV52:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 12
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);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// For against button click in the grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvJournalVoucher_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex >= 0)
                {
                    if (dgvJournalVoucher.CurrentCell.ColumnIndex == dgvJournalVoucher.Columns["dgvbtnAgainst"].Index)
                    {
                        AccountLedgerSP SpAccountLedger = new AccountLedgerSP();
                        if (dgvJournalVoucher.CurrentRow.Cells["dgvcmbAccountLedger"].Value != null && dgvJournalVoucher.CurrentRow.Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty)
                        {
                            if (dgvJournalVoucher.CurrentRow.Cells["dgvcmbDrOrCr"].Value != null && dgvJournalVoucher.CurrentRow.Cells["dgvcmbDrOrCr"].Value.ToString() != string.Empty)
                            {
                                if (SpAccountLedger.AccountGroupIdCheck(dgvJournalVoucher.CurrentRow.Cells["dgvcmbAccountLedger"].FormattedValue.ToString()))
                                {
                                    frmPartyBalanceObj = new frmPartyBalance();
                                    frmPartyBalanceObj.MdiParent = formMDI.MDIObj;
                                    decimal decLedgerId = Convert.ToDecimal(dgvJournalVoucher.CurrentRow.Cells["dgvcmbAccountLedger"].Value.ToString());

                                    string strDebitOrCredit = dgvJournalVoucher.CurrentRow.Cells["dgvcmbDrOrCr"].Value.ToString();
                                    if (!isAutomatic)
                                    {
                                        frmPartyBalanceObj.CallFromJournalVoucher(this, decLedgerId, dtblPartyBalance, strDebitOrCredit, decJournalVoucherTypeId, txtVoucherNo.Text, Convert.ToDateTime(txtDate.Text), arrlstOfDeletedPartyBalanceRow);
                                    }
                                    else
                                    {
                                        frmPartyBalanceObj.CallFromJournalVoucher(this, decLedgerId, dtblPartyBalance, strDebitOrCredit, decJournalVoucherTypeId, strVoucherNo, Convert.ToDateTime(txtDate.Text), arrlstOfDeletedPartyBalanceRow);
                                    }

                                }

                            }
                            else
                            {
                                Messages.InformationMessage("Select debit or credit");
                            }
                        }
                        else
                        {
                            Messages.InformationMessage("Select any ledger");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("JV55:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 14
0
 /// <summary>
 /// Function to update values in partyBalance table
 /// </summary>
 public void partyBalanceUpdate()
 {
     try
     {
         AccountLedgerSP spLedger = new AccountLedgerSP();
         spLedger.PartyBalanceDeleteByVoucherTypeVoucherNoAndReferenceType(decLedgerIdForEdit.ToString(), 1);
         if (decOpeningBlnc > 0)
         {
             partyBalance();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Cus17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 15
0
 /// <summary>
 /// Function to update values in ledgerposting table
 /// </summary>
 public void ledgerUpdate()
 {
     try
     {
         string strfinancialId;
         FinancialYearSP spFinancialYear = new FinancialYearSP();
         FinancialYearInfo infoFinancialYear = new FinancialYearInfo();
         infoFinancialYear = spFinancialYear.FinancialYearViewForAccountLedger(1);
         strfinancialId = infoFinancialYear.FromDate.ToString("dd-MMM-yyyy");
         decimal decLedgerPostingId = 0;
         if (txtOpeningBalance.Text.Trim() != string.Empty)
         {
             decOpeningBlnc = Convert.ToDecimal(txtOpeningBalance.Text.Trim());
         }
         else
         {
             decOpeningBlnc = 0;
         }
         LedgerPostingSP spLedgerPosting = new LedgerPostingSP();
         LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo();
         DataTable dtbl = spLedgerPosting.GetLedgerPostingIds(decLedgerIdForEdit.ToString(), 1);
         foreach (DataRow dr in dtbl.Rows)
         {
             decLedgerPostingId = Convert.ToDecimal(dr.ItemArray[0].ToString());
         }
         if (cmbDrorCr.Text == "Dr")
         {
             infoLedgerPosting.Debit = decOpeningBlnc;
         }
         else
         {
             infoLedgerPosting.Credit = decOpeningBlnc;
         }
         infoLedgerPosting.LedgerPostingId = decLedgerPostingId;
         infoLedgerPosting.VoucherTypeId = 1;
         infoLedgerPosting.VoucherNo = decLedgerIdForEdit.ToString();
         infoLedgerPosting.Date = Convert.ToDateTime(strfinancialId.ToString());
         infoLedgerPosting.LedgerId = decLedgerIdForEdit;
         infoLedgerPosting.DetailsId = 0;
         infoLedgerPosting.InvoiceNo = decLedgerIdForEdit.ToString();
         infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
         infoLedgerPosting.ChequeDate = DateTime.Now;
         infoLedgerPosting.ChequeNo = string.Empty;
         infoLedgerPosting.Extra1 = string.Empty;
         infoLedgerPosting.Extra2 = string.Empty;
         if (dtbl.Rows.Count > 0)
         {
             if (decOpeningBlnc > 0)
             {
                 spLedgerPosting.LedgerPostingEdit(infoLedgerPosting);
             }
             else
             {
                 AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                 spAccountLedger.LedgerPostingDeleteByVoucherTypeAndVoucherNo(decLedgerIdForEdit.ToString(), 1);
             }
         }
         else
         {
             spLedgerPosting.LedgerPostingAdd(infoLedgerPosting);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Cus16:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 16
0
        /// <summary>
        /// Function to fill the fields for edit or delete
        /// </summary>
        public void FillFunction()
        {
            try
            {
                JournalMasterInfo infoJournalMaster = new JournalMasterInfo();
                JournalMasterSP spJournalMaster = new JournalMasterSP();
                infoJournalMaster = spJournalMaster.JournalMasterView(decJournalMasterIdForEdit);

                VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
                VoucherTypeSP spVoucherType = new VoucherTypeSP();
                infoVoucherType = spVoucherType.VoucherTypeView(infoJournalMaster.VoucherTypeId);
                this.Text = infoVoucherType.VoucherTypeName;

                txtVoucherNo.ReadOnly = false;
                strVoucherNo = infoJournalMaster.VoucherNo;
                strInvoiceNo = infoJournalMaster.InvoiceNo;
                txtVoucherNo.Text = strInvoiceNo;
                decJournalSuffixPrefixId = infoJournalMaster.SuffixPrefixId;
                decJournalVoucherTypeId = infoJournalMaster.VoucherTypeId;
                dtpVoucherDate.Value = infoJournalMaster.Date;
                txtNarration.Text = infoJournalMaster.Narration;

                isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decJournalVoucherTypeId);
                if (isAutomatic)
                {
                    txtVoucherNo.ReadOnly = true;
                }
                else
                {
                    txtVoucherNo.ReadOnly = false;
                }

                //GridFill
                DataTable dtbl = new DataTable();
                JournalDetailsSP spJournalDetailsSp = new JournalDetailsSP();
                dtbl = spJournalDetailsSp.JournalDetailsViewByMasterId(decJournalMasterIdForEdit);

                AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                LedgerPostingSP spLedgerPosting = new LedgerPostingSP();
                for (int inI = 0; inI < dtbl.Rows.Count; inI++)
                {
                    dgvJournalVoucher.Rows.Add();
                    dgvJournalVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString());

                    if (Convert.ToDecimal(dtbl.Rows[inI]["debit"].ToString()) == 0)
                    {
                        dgvJournalVoucher.Rows[inI].Cells["dgvcmbDrOrCr"].Value = "Cr";
                        dgvJournalVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = Convert.ToDecimal(dtbl.Rows[inI]["credit"].ToString());
                    }
                    else
                    {
                        dgvJournalVoucher.Rows[inI].Cells["dgvcmbDrOrCr"].Value = "Dr";
                        dgvJournalVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = Convert.ToDecimal(dtbl.Rows[inI]["debit"].ToString());
                    }
                    dgvJournalVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(dtbl.Rows[inI]["exchangeRateId"].ToString());
                    if (dtbl.Rows[inI]["chequeNo"].ToString() != string.Empty)
                    {
                        dgvJournalVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value = dtbl.Rows[inI]["chequeNo"].ToString();
                        dgvJournalVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value = (Convert.ToDateTime(dtbl.Rows[inI]["chequeDate"].ToString())).ToString("dd-MMM-yyyy");
                    }
                    dgvJournalVoucher.Rows[inI].Cells["dgvtxtDetailsId"].Value = dtbl.Rows[inI]["journalDetailsId"].ToString();

                    decimal decDetailsId1 = Convert.ToDecimal(dtbl.Rows[inI]["journalDetailsId"].ToString());
                    decimal decLedgerPostingId = spLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, decJournalVoucherTypeId);
                    dgvJournalVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString();
                    btnSave.Text = "Update";

                }

                PartyBalanceSP SpPartyBalance = new PartyBalanceSP();
                DataTable dtbl1 = new DataTable();
                dtbl1 = SpPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decJournalVoucherTypeId, strVoucherNo, infoJournalMaster.Date);


                dtblPartyBalance = dtbl1;
                dgvJournalVoucher.ClearSelection();
                txtDate.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show("JV37:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// On cellvalueChanged of dgvCreditNote
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvJournalVoucher_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1 && e.ColumnIndex != -1)
                {
                    DebitAndCreditTotal();

                    if (dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].Value != null && dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty)
                    {

                        if (dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value == null || dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value.ToString() == string.Empty)
                        {
                            dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(1); //decExchangeRateId;
                        }

                    }

                    if (dgvJournalVoucher.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvcmbAccountLedger")
                    {
                        /*************Remove partybalance while changing the ledger ************/
                        if (inUpdatingRowIndexForPartyRemove != -1)
                        {
                            int inTableRowCount = dtblPartyBalance.Rows.Count;
                            for (int inJ = 0; inJ < inTableRowCount; inJ++)
                            {
                                if (dtblPartyBalance.Rows.Count == inJ)
                                {
                                    break;
                                }

                                if (Convert.ToDecimal(dtblPartyBalance.Rows[inJ]["ledgerId"].ToString()) == decUpdatingLedgerForPartyremove)
                                {
                                    if (dtblPartyBalance.Rows[inJ]["PartyBalanceId"].ToString() != "0")
                                    {
                                        arrlstOfDeletedPartyBalanceRow.Add(dtblPartyBalance.Rows[inJ]["PartyBalanceId"]);
                                    }
                                    dtblPartyBalance.Rows.RemoveAt(inJ);
                                    inJ--;
                                }
                            }

                            dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvtxtAmount"].Value = string.Empty;

                            //reset
                            decUpdatingLedgerForPartyremove = 0;
                            inUpdatingRowIndexForPartyRemove = -1;
                        }
                        /*************************************************************************/

                        //-----------To make amount readonly when party is selected as ledger------------------------------//
                        AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                        if (spAccountLedger.AccountGroupIdCheck(dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].FormattedValue.ToString()))
                        {
                            dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvtxtAmount"].Value = string.Empty;
                            dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvtxtAmount"].ReadOnly = true;

                        }
                        else
                        {
                            dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvtxtAmount"].Value = string.Empty;
                            dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvtxtAmount"].ReadOnly = false;
                            SettingsSP spSettings = new SettingsSP();
                            if (spSettings.SettingsStatusCheck("MultiCurrency") == "Yes")
                            {
                                dgvcmbCurrency.ReadOnly = false;
                            }
                            else
                            {
                                dgvcmbCurrency.ReadOnly = true;

                            }
                        }

                        //========================================================================================//
                    }

                    if (dgvJournalVoucher.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvcmbDrOrCr")
                    {
                        /*************Remove partybalance while changing the Dr/Cr ************/
                        if (inUpdatingRowIndexForPartyRemove != -1)
                        {
                            int inTableRowCount = dtblPartyBalance.Rows.Count;
                            for (int inJ = 0; inJ < inTableRowCount; inJ++)
                            {
                                if (dtblPartyBalance.Rows.Count == inJ)
                                {
                                    break;
                                }

                                if (Convert.ToDecimal(dtblPartyBalance.Rows[inJ]["ledgerId"].ToString()) == decUpdatingLedgerForPartyremove)
                                {
                                    if (dtblPartyBalance.Rows[inJ]["PartyBalanceId"].ToString() != "0")
                                    {
                                        arrlstOfDeletedPartyBalanceRow.Add(dtblPartyBalance.Rows[inJ]["PartyBalanceId"]);
                                    }
                                    dtblPartyBalance.Rows.RemoveAt(inJ);
                                    inJ--;
                                }
                            }
                            dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvtxtAmount"].Value = string.Empty;

                            //reset
                            decUpdatingLedgerForPartyremove = 0;
                            inUpdatingRowIndexForPartyRemove = -1;
                        }
                        /*************************************************************************/
                    }

                    //-----------------------------------Chequedate validation----------------------------------//
                    DateValidation obj = new DateValidation();
                    TextBox txtDate1 = new TextBox();
                    if (dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].Value != null && dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].Value.ToString() != string.Empty)
                    {
                        txtDate1.Text = dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].Value.ToString();
                        bool isInvalid = obj.DateValidationFunction(txtDate1);
                        if (!isInvalid)
                        {
                            dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].Value = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy");
                        }
                        else
                        {
                            dgvJournalVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].Value = txtDate1.Text;
                        }
                    }
                    //=========================================================================================//
                    //---------------------check column missing---------------------------------//

                    CheckColumnMissing(e);

                    //==========================================================================//

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("JV50:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 18
0
 /// <summary>
 /// Adding columns to print
 /// </summary>
 /// <param name="decDeliveryNoteMasterId"></param>
 public void PrintForDotMatrix(decimal decDeliveryNoteMasterId)
 {
     try
     {
         DataTable dtblOtherDetails = new DataTable();
         CompanySP spComapany = new CompanySP();
         dtblOtherDetails = spComapany.CompanyViewForDotMatrix();
         //-------------Grid Details-------------------\\
         DataTable dtblGridDetails = new DataTable();
         dtblGridDetails.Columns.Add("SlNo");
         dtblGridDetails.Columns.Add("BarCode");
         dtblGridDetails.Columns.Add("ProductCode");
         dtblGridDetails.Columns.Add("ProductName");
         dtblGridDetails.Columns.Add("Qty");
         dtblGridDetails.Columns.Add("Unit");
         dtblGridDetails.Columns.Add("Godown");
         dtblGridDetails.Columns.Add("Rack");
         dtblGridDetails.Columns.Add("Batch");
         dtblGridDetails.Columns.Add("Rate");
         dtblGridDetails.Columns.Add("Amount");
         int inRowCount = 0;
         foreach (DataGridViewRow dRow in dgvProduct.Rows)
         {
             if (!dRow.IsNewRow)
             {
                 DataRow dr = dtblGridDetails.NewRow();
                 dr["SlNo"] = ++inRowCount;
                 if (dRow.Cells["dgvtxtBarcode"].Value != null)
                 {
                     dr["BarCode"] = dRow.Cells["dgvtxtBarcode"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtProductCode"].Value != null)
                 {
                     dr["ProductCode"] = dRow.Cells["dgvtxtProductCode"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtProductName"].Value != null)
                 {
                     dr["ProductName"] = dRow.Cells["dgvtxtProductName"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtQty"].Value != null)
                 {
                     dr["Qty"] = dRow.Cells["dgvtxtQty"].Value.ToString();
                 }
                 if (dRow.Cells["dgvcmbUnit"].Value != null)
                 {
                     dr["Unit"] = dRow.Cells["dgvcmbUnit"].FormattedValue.ToString();
                 }
                 if (dRow.Cells["dgvcmbGodown"].Value != null)
                 {
                     dr["Godown"] = dRow.Cells["dgvcmbGodown"].FormattedValue.ToString();
                 }
                 if (dRow.Cells["dgvcmbRack"].Value != null)
                 {
                     dr["Rack"] = dRow.Cells["dgvcmbRack"].FormattedValue.ToString();
                 }
                 if (dRow.Cells["dgvcmbBatch"].Value != null)
                 {
                     dr["Batch"] = dRow.Cells["dgvcmbBatch"].FormattedValue.ToString();
                 }
                 if (dRow.Cells["dgvtxtRate"].Value != null)
                 {
                     dr["Rate"] = dRow.Cells["dgvtxtRate"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtAmount"].Value != null)
                 {
                     dr["Amount"] = dRow.Cells["dgvtxtAmount"].Value.ToString();
                 }
                 dtblGridDetails.Rows.Add(dr);
             }
         }
         //-------------Other Details-------------------\\
         dtblOtherDetails.Columns.Add("voucherNo");
         dtblOtherDetails.Columns.Add("date");
         dtblOtherDetails.Columns.Add("ledgerName");
         dtblOtherDetails.Columns.Add("Narration");
         dtblOtherDetails.Columns.Add("Currency");
         dtblOtherDetails.Columns.Add("TotalAmount");
         dtblOtherDetails.Columns.Add("DeliveryMode");
         dtblOtherDetails.Columns.Add("PricingLevel");
         dtblOtherDetails.Columns.Add("Type");
         dtblOtherDetails.Columns.Add("SalesMan");
         dtblOtherDetails.Columns.Add("CustomerAddress");
         dtblOtherDetails.Columns.Add("CustomerTIN");
         dtblOtherDetails.Columns.Add("CustomerCST");
         dtblOtherDetails.Columns.Add("AmountInWords");
         dtblOtherDetails.Columns.Add("Declaration");
         dtblOtherDetails.Columns.Add("Heading1");
         dtblOtherDetails.Columns.Add("Heading2");
         dtblOtherDetails.Columns.Add("Heading3");
         dtblOtherDetails.Columns.Add("Heading4");
         DataRow dRowOther = dtblOtherDetails.Rows[0];
         dRowOther["voucherNo"] = txtDeliveryNoteNo.Text;
         dRowOther["date"] = txtDate.Text;
         dRowOther["ledgerName"] = cmbCashOrParty.Text;
         dRowOther["Narration"] = txtNarration.Text;
         dRowOther["Currency"] = cmbCurrency.Text;
         dRowOther["TotalAmount"] = txtTotalAmnt.Text;
         dRowOther["DeliveryMode"] = cmbDeliveryMode.Text;
         dRowOther["PricingLevel"] = cmbPricingLevel.Text;
         dRowOther["Type"] = cmbType.Text;
         dRowOther["SalesMan"] = cmbSalesMan.Text;
         dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", "");
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo();
         infoAccountLedger = spAccountLedger.AccountLedgerView(Convert.ToDecimal(cmbCashOrParty.SelectedValue));
         dRowOther["CustomerAddress"] = (infoAccountLedger.Address.ToString().Replace("\n", ", ")).Replace("\r", "");
         dRowOther["CustomerTIN"] = infoAccountLedger.Tin;
         dRowOther["CustomerCST"] = infoAccountLedger.Cst;
         dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtTotalAmnt.Text), PublicVariables._decCurrencyId);
         VoucherTypeSP spVoucherType = new VoucherTypeSP();
         DataTable dtblDeclaration = spVoucherType.DeclarationAndHeadingGetByVoucherTypeId(decDeliveryNoteVoucherTypeId);
         dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString();
         dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString();
         dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString();
         dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString();
         dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString();
         int inFormId = spVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString()));
         PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails);
     }
     catch (Exception ex)
     {
         MessageBox.Show("DN41:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 19
0
 /// <summary>
 /// Function to fill BankorCash combobox while return from Ledger creation when creating new ledger 
 /// </summary>
 /// <param name="decId"></param>
 /// <param name="str"></param>
 public void ReturnFromAccountLedgerForm(decimal decId, string str)
 {
     try
     {
         if (str == "CashOrBank")
         {
             if (decId != 0)
             {
                 TransactionsGeneralFill Obj = new TransactionsGeneralFill();
                 Obj.CashOrBankComboFill(cmbBankorCash, false);
                 cmbBankorCash.SelectedValue = decId.ToString();
             }
             cmbBankorCash.Focus();
         }
         else
         {
             if (decId != 0)
             {
                 int inCurrentRowIndex = dgvPaymentVoucher.CurrentRow.Index;
                 if (inCurrentRowIndex == dgvPaymentVoucher.Rows.Count - 1)
                 {
                     dgvPaymentVoucher.Rows.Add();
                 }
                 dgvPaymentVoucher.CurrentRow.HeaderCell.Value = "X";
                 dgvPaymentVoucher.CurrentRow.HeaderCell.Style.ForeColor = Color.Red;
                 DataTable dtbl = new DataTable();
                 AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                 dtbl = spAccountLedger.AccountLedgerViewAll();
                 DataGridViewComboBoxCell dgvccCashOrBank = (DataGridViewComboBoxCell)dgvPaymentVoucher[dgvPaymentVoucher.Columns["dgvcmbAccountLedger"].Index, dgvPaymentVoucher.Rows[inCurrentRowIndex].Index];
                 DataRow dr = dtbl.NewRow();
                 dr["ledgerId"] = "0";
                 dr["ledgerName"] = string.Empty;
                 dtbl.Rows.InsertAt(dr, 0);
                 dgvccCashOrBank.DataSource = dtbl;
                 dgvccCashOrBank.ValueMember = "ledgerId";
                 dgvccCashOrBank.DisplayMember = "ledgerName";
                 dgvPaymentVoucher.Rows[inCurrentRowIndex].Cells["dgvcmbAccountLedger"].Value = decId;
                 dgvPaymentVoucher.Rows[inCurrentRowIndex].Cells["dgvcmbAccountLedger"].Selected = true;
           
                 
             }
         }
         
         this.Enabled = true;
         this.BringToFront();
     }
     catch (Exception ex)
     {
         MessageBox.Show("PV29:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 20
0
 public int PartyBalanceCheckWithReference()
 {
     int inF1 = 0;
     decimal decPartyBalanceAmount = 0;
     decimal decGrandTotal = 0;
     try
     {
         bool isRef = false;
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         PartyBalanceSP spPartyBalance = new PartyBalanceSP();
         isRef = spAccountLedger.PartyBalanceAgainstReferenceCheck(strVoucherNo, DecSalesInvoiceVoucherTypeId);
         if (isRef)
         {
             decPartyBalanceAmount = spPartyBalance.PartyBalanceAmountViewForSalesInvoice(strVoucherNo, DecSalesInvoiceVoucherTypeId, "Against");
             decGrandTotal = Convert.ToDecimal(txtGrandTotal.Text);
             if (decGrandTotal >= decPartyBalanceAmount)
             {
                 inF1 = 1;
             }
             else
             {
                 inF1 = 0;
                 Messages.InformationMessage("There is a Receipt voucher against this invoice so grand total should not be less than " + decPartyBalanceAmount);
             }
         }
         else
         {
             inF1 = 1;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI36:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return inF1;
 }
Exemplo n.º 21
0
        /// <summary>
        /// Gridview cell value changed , doing basic calculations and checking invalid entries
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvPaymentVoucher_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1 && e.ColumnIndex != -1)
                {
                    TotalAmount();

                    if (dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].Value != null && dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty)
                    {

                        if (dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value == null || dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value.ToString() == string.Empty)
                        {
                            dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(1);
                        }

                    }
                    AccountGroupSP spAccountGroup = new AccountGroupSP();
                    AccountLedgerSP SpAccountLedger = new AccountLedgerSP();
                    if (dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].Value != null && dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].Value.ToString().Trim() != string.Empty)
                    {
                        if (dgvPaymentVoucher.CurrentCell.ColumnIndex == dgvPaymentVoucher.CurrentRow.Cells["dgvcmbAccountLedger"].ColumnIndex)
                        {

                            /*************Remove partybalance while changing the ledger ************/
                            if (inUpdatingRowIndexForPartyRemove != -1)
                            {
                                int inTableRowCount = dtblPartyBalance.Rows.Count;
                                for (int inJ = 0; inJ < inTableRowCount; inJ++)
                                {
                                    if (dtblPartyBalance.Rows.Count == inJ)
                                    {
                                        break;
                                    }
                                    if (Convert.ToDecimal(dtblPartyBalance.Rows[inJ]["ledgerId"].ToString()) == decUpdatingLedgerForPartyremove)
                                    {
                                        if (dtblPartyBalance.Rows[inJ]["PartyBalanceId"].ToString() != "0")
                                        {
                                            arrlstOfDeletedPartyBalanceRow.Add(dtblPartyBalance.Rows[inJ]["PartyBalanceId"]);
                                        }
                                        dtblPartyBalance.Rows.RemoveAt(inJ);
                                        inJ--;
                                    }
                                }
                                dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvtxtAmount"].Value = string.Empty;
                                decUpdatingLedgerForPartyremove = 0;
                                inUpdatingRowIndexForPartyRemove = -1;
                            }
                            /*************************************************************************/
                            decimal decLedgerId = Convert.ToDecimal(dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].Value.ToString());
                            bool IsBankAccount = spAccountGroup.AccountGroupwithLedgerId(decLedgerId);
                            decimal decI = Convert.ToDecimal(SpAccountLedger.AccountGroupIdCheck(dgvPaymentVoucher.CurrentRow.Cells["dgvcmbAccountLedger"].FormattedValue.ToString()));
                            if (decI > 0)//to make amount and currency read only when party is choosen as ledger
                            {
                                dgvPaymentVoucher.CurrentRow.Cells["dgvtxtAmount"].ReadOnly = true;
                                dgvPaymentVoucher.CurrentRow.Cells["dgvtxtAmount"].Value = string.Empty;
                                dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(1);
                                dgvPaymentVoucher.CurrentRow.Cells["dgvcmbCurrency"].ReadOnly = true;
                            }
                            else
                            {
                                dgvPaymentVoucher.CurrentRow.Cells["dgvtxtAmount"].ReadOnly = false;
                                SettingsSP spSettings = new SettingsSP();
                                if (spSettings.SettingsStatusCheck("MultiCurrency") == "Yes")
                                {
                                    dgvcmbCurrency.ReadOnly = false;
                                }
                                else
                                {
                                    dgvcmbCurrency.ReadOnly = true;

                                }
                            }
                        }
                    }
                    CheckColumnMissing();
                    DateValidation objVal = new DateValidation();
                    TextBox txtDate1 = new TextBox();
                    if (dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].Value != null)
                    {

                        txtDate1.Text = dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].Value.ToString();
                        bool isDate = objVal.DateValidationFunction(txtDate1);
                        if (isDate)
                        {
                            dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].Value = txtDate1.Text;
                        }
                        else
                        {
                            dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].Value = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PV48:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 22
0
 /// <summary>
 /// Print function for dotmatrix printer
 /// </summary>
 /// <param name="decSalesMasterId"></param>
 public void PrintForDotMatrix(decimal decSalesMasterId)
 {
     try
     {
         DataTable dtblOtherDetails = new DataTable();
         CompanySP spComapany = new CompanySP();
         dtblOtherDetails = spComapany.CompanyViewForDotMatrix();
         DataTable dtblGridDetails = new DataTable();
         dtblGridDetails.Columns.Add("SlNo");
         dtblGridDetails.Columns.Add("BarCode");
         dtblGridDetails.Columns.Add("ProductCode");
         dtblGridDetails.Columns.Add("ProductName");
         dtblGridDetails.Columns.Add("Qty");
         dtblGridDetails.Columns.Add("Unit");
         dtblGridDetails.Columns.Add("Godown");
         dtblGridDetails.Columns.Add("Brand");
         dtblGridDetails.Columns.Add("Tax");
         dtblGridDetails.Columns.Add("TaxAmount");
         dtblGridDetails.Columns.Add("NetAmount");
         dtblGridDetails.Columns.Add("DiscountAmount");
         dtblGridDetails.Columns.Add("DiscountPercentage");
         dtblGridDetails.Columns.Add("SalesRate");
         dtblGridDetails.Columns.Add("PurchaseRate");
         dtblGridDetails.Columns.Add("MRP");
         dtblGridDetails.Columns.Add("Rack");
         dtblGridDetails.Columns.Add("Batch");
         dtblGridDetails.Columns.Add("Rate");
         dtblGridDetails.Columns.Add("Amount");
         int inRowCount = 0;
         foreach (DataGridViewRow dRow in dgvSalesInvoice.Rows)
         {
             if (!dRow.IsNewRow)
             {
                 DataRow dr = dtblGridDetails.NewRow();
                 dr["SlNo"] = ++inRowCount;
                 if (dRow.Cells["dgvtxtSalesInvoiceBarcode"].Value != null)
                 {
                     dr["BarCode"] = dRow.Cells["dgvtxtSalesInvoiceBarcode"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtSalesInvoiceProductCode"].Value != null)
                 {
                     dr["ProductCode"] = dRow.Cells["dgvtxtSalesInvoiceProductCode"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtSalesInvoiceProductName"].Value != null)
                 {
                     dr["ProductName"] = dRow.Cells["dgvtxtSalesInvoiceProductName"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtSalesInvoiceQty"].Value != null)
                 {
                     dr["Qty"] = dRow.Cells["dgvtxtSalesInvoiceQty"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtSalesInvoicembUnitName"].Value != null)
                 {
                     dr["Unit"] = dRow.Cells["dgvtxtSalesInvoicembUnitName"].FormattedValue.ToString();
                 }
                 if (dRow.Cells["dgvcmbSalesInvoiceGodown"].Value != null)
                 {
                     dr["Godown"] = dRow.Cells["dgvcmbSalesInvoiceGodown"].FormattedValue.ToString();
                 }
                 if (dRow.Cells["dgvcmbSalesInvoiceRack"].Value != null)
                 {
                     dr["Rack"] = dRow.Cells["dgvcmbSalesInvoiceRack"].FormattedValue.ToString();
                 }
                 if (dRow.Cells["dgvcmbSalesInvoiceBatch"].Value != null)
                 {
                     dr["Batch"] = dRow.Cells["dgvcmbSalesInvoiceBatch"].FormattedValue.ToString();
                 }
                 if (dRow.Cells["dgvtxtSalesInvoiceRate"].Value != null)
                 {
                     dr["Rate"] = dRow.Cells["dgvtxtSalesInvoiceRate"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtSalesInvoiceAmount"].Value != null)
                 {
                     dr["Amount"] = dRow.Cells["dgvtxtSalesInvoiceAmount"].Value.ToString();
                 }
                 if (dRow.Cells["dgvcmbSalesInvoiceTaxName"].Value != null)
                 {
                     dr["Tax"] = dRow.Cells["dgvcmbSalesInvoiceTaxName"].FormattedValue.ToString();
                 }
                 if (dRow.Cells["dgvtxtSalesInvoiceBrand"].Value != null)
                 {
                     dr["Brand"] = dRow.Cells["dgvtxtSalesInvoiceBrand"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtSalesInvoiceTaxAmount"].Value != null)
                 {
                     dr["TaxAmount"] = dRow.Cells["dgvtxtSalesInvoiceTaxAmount"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtSalesInvoiceNetAmount"].Value != null)
                 {
                     dr["NetAmount"] = dRow.Cells["dgvtxtSalesInvoiceNetAmount"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtSalesInvoiceDiscountAmount"].Value != null)
                 {
                     dr["DiscountAmount"] = dRow.Cells["dgvtxtSalesInvoiceDiscountAmount"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtSalesInvoiceDiscountPercentage"].Value != null)
                 {
                     dr["DiscountPercentage"] = dRow.Cells["dgvtxtSalesInvoiceDiscountPercentage"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtSalesInvoiceSalesRate"].Value != null)
                 {
                     dr["SalesRate"] = dRow.Cells["dgvtxtSalesInvoiceSalesRate"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtSalesInvoicePurchaseRate"].Value != null)
                 {
                     dr["PurchaseRate"] = dRow.Cells["dgvtxtSalesInvoicePurchaseRate"].Value.ToString();
                 }
                 if (dRow.Cells["dgvtxtSalesInvoiceMrp"].Value != null)
                 {
                     dr["MRP"] = dRow.Cells["dgvtxtSalesInvoiceMrp"].Value.ToString();
                 }
                 dtblGridDetails.Rows.Add(dr);
             }
         }
         dtblOtherDetails.Columns.Add("voucherNo");
         dtblOtherDetails.Columns.Add("date");
         dtblOtherDetails.Columns.Add("ledgerName");
         dtblOtherDetails.Columns.Add("SalesMode");
         dtblOtherDetails.Columns.Add("SalesAccount");
         dtblOtherDetails.Columns.Add("SalesMan");
         dtblOtherDetails.Columns.Add("CreditPeriod");
         dtblOtherDetails.Columns.Add("VoucherType");
         dtblOtherDetails.Columns.Add("PricingLevel");
         dtblOtherDetails.Columns.Add("Customer");
         dtblOtherDetails.Columns.Add("CustomerAddress");
         dtblOtherDetails.Columns.Add("CustomerTIN");
         dtblOtherDetails.Columns.Add("CustomerCST");
         dtblOtherDetails.Columns.Add("Narration");
         dtblOtherDetails.Columns.Add("Currency");
         dtblOtherDetails.Columns.Add("TotalAmount");
         dtblOtherDetails.Columns.Add("BillDiscount");
         dtblOtherDetails.Columns.Add("GrandTotal");
         dtblOtherDetails.Columns.Add("AmountInWords");
         dtblOtherDetails.Columns.Add("Declaration");
         dtblOtherDetails.Columns.Add("Heading1");
         dtblOtherDetails.Columns.Add("Heading2");
         dtblOtherDetails.Columns.Add("Heading3");
         dtblOtherDetails.Columns.Add("Heading4");
         DataRow dRowOther = dtblOtherDetails.Rows[0];
         dRowOther["voucherNo"] = txtInvoiceNo.Text;
         dRowOther["date"] = txtDate.Text;
         dRowOther["ledgerName"] = cmbCashOrParty.Text;
         dRowOther["Narration"] = txtNarration.Text;
         dRowOther["Currency"] = cmbCurrency.Text;
         dRowOther["SalesMode"] = cmbSalesMode.Text;
         dRowOther["SalesAccount"] = cmbSalesAccount.Text;
         dRowOther["SalesMan"] = cmbSalesMan.SelectedText;
         dRowOther["CreditPeriod"] = (txtCreditPeriod.Text) + " Days";
         dRowOther["PricingLevel"] = cmbPricingLevel.Text;
         dRowOther["Customer"] = txtCustomer.Text;
         dRowOther["BillDiscount"] = txtBillDiscount.Text;
         dRowOther["GrandTotal"] = txtGrandTotal.Text;
         dRowOther["TotalAmount"] = txtTotalAmount.Text;
         dRowOther["VoucherType"] = cmbVoucherType.Text;
         dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", "");
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo();
         infoAccountLedger = spAccountLedger.AccountLedgerView(Convert.ToDecimal(cmbCashOrParty.SelectedValue));
         dRowOther["CustomerAddress"] = (infoAccountLedger.Address.ToString().Replace("\n", ", ")).Replace("\r", "");
         dRowOther["CustomerTIN"] = infoAccountLedger.Tin;
         dRowOther["CustomerCST"] = infoAccountLedger.Cst;
         dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtGrandTotal.Text), PublicVariables._decCurrencyId);
         VoucherTypeSP spVoucherType = new VoucherTypeSP();
         DataTable dtblDeclaration = spVoucherType.DeclarationAndHeadingGetByVoucherTypeId(DecSalesInvoiceVoucherTypeId);
         dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString();
         dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString();
         dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString();
         dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString();
         dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString();
         int inFormId = spVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString()));
         PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails);
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI: 74" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 23
0
 /// <summary>
 /// Cell begin edit event of grid, its for removing the item from the list once its added or Selected
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvPaymentVoucher_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     try
     {
         inUpdatingRowIndexForPartyRemove = -1;
         decUpdatingLedgerForPartyremove = 0;
         DataTable dtbl = new DataTable();
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         if (dgvPaymentVoucher.CurrentCell.ColumnIndex == dgvPaymentVoucher.Columns["dgvcmbAccountLedger"].Index)
         {
             dtbl = spAccountLedger.AccountLedgerViewAll();
             if (dtbl.Rows.Count < 2)
             {
                 DataRow dr = dtbl.NewRow();
                 dr[0] = string.Empty;
                 dr[1] = string.Empty;
                 dtbl.Rows.InsertAt(dr, 0);
             }
             if (dgvPaymentVoucher.RowCount > 1)
             {
                 int inGridRowCount = dgvPaymentVoucher.RowCount;
                 for (int inI = 0; inI < inGridRowCount - 1; inI++)
                 {
                     if (inI != e.RowIndex)
                     {
                         int inTableRowcount = dtbl.Rows.Count;
                         for (int inJ = 0; inJ < inTableRowcount; inJ++)
                         {
                             if (dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value != null && dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty)
                             {
                                 if (dtbl.Rows[inJ]["ledgerId"].ToString() == dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value.ToString())
                                 {
                                     dtbl.Rows.RemoveAt(inJ);
                                     break;
                                 }
                             }
                         }
                     }
                 }
             }
             DataGridViewComboBoxCell dgvccCashOrBank = (DataGridViewComboBoxCell)dgvPaymentVoucher[dgvPaymentVoucher.Columns["dgvcmbAccountLedger"].Index, e.RowIndex];
             DataRow drow = dtbl.NewRow();
             drow["ledgerId"] = "0";
             drow["ledgerName"] = string.Empty;
             dtbl.Rows.InsertAt(drow, 0);
             dgvccCashOrBank.DataSource = dtbl;
             dgvccCashOrBank.ValueMember = "ledgerId";
             dgvccCashOrBank.DisplayMember = "ledgerName";
         }
         if (dgvPaymentVoucher.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvcmbAccountLedger")
         {
             if (dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].Value != null && dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty)
             {
                 if (spAccountLedger.AccountGroupIdCheck(dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].FormattedValue.ToString()))
                 {
                     inUpdatingRowIndexForPartyRemove = e.RowIndex;
                     decUpdatingLedgerForPartyremove = Convert.ToDecimal(dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].Value.ToString());
                 }
             }
         }
         if (dgvPaymentVoucher.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvcmbDrOrCr")
         {
             if (dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].Value != null && dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty)
             {
                 if (spAccountLedger.AccountGroupIdCheck(dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].FormattedValue.ToString()))
                 {
                     inUpdatingRowIndexForPartyRemove = e.RowIndex;
                     decUpdatingLedgerForPartyremove = Convert.ToDecimal(dgvPaymentVoucher.Rows[e.RowIndex].Cells["dgvcmbAccountLedger"].Value.ToString());
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PV54:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 24
0
 /// <summary>
 /// Fill function from coming from register or report or other forms
 /// </summary>
 public void FillRegisterOrReport()
 {
     SalesMasterSP spSalesMaster = new SalesMasterSP();
     SalesDetailsSP spSalesDetails = new SalesDetailsSP();
     VoucherTypeSP spVoucherType = new VoucherTypeSP();
     SalesBillTaxSP spSalesBillTax = new SalesBillTaxSP();
     try
     {
         isFromEditMode = true;
         btnSave.Text = "Update";
         btnDelete.Enabled = true;
         txtInvoiceNo.ReadOnly = true;
         DataTable dtblMaster = spSalesMaster.SalesInvoiceSalesMasterViewBySalesMasterId(decSalesInvoiceIdToEdit);
         DecSalesInvoiceVoucherTypeId = Convert.ToDecimal(dtblMaster.Rows[0]["voucherTypeId"].ToString());
         VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
         infoVoucherType = spVoucherType.VoucherTypeView(DecSalesInvoiceVoucherTypeId);
         this.Text = infoVoucherType.VoucherTypeName;
         txtDate.Text = dtblMaster.Rows[0]["date"].ToString();
         dtpDate.Value = DateTime.Parse(txtDate.Text);
         CurrencyComboFill();
         txtInvoiceNo.Text = dtblMaster.Rows[0]["invoiceNo"].ToString();
         txtCreditPeriod.Text = dtblMaster.Rows[0]["creditPeriod"].ToString();
         strVoucherNo = dtblMaster.Rows[0]["voucherNo"].ToString();
         decSalseInvoiceSuffixPrefixId = Convert.ToDecimal(dtblMaster.Rows[0]["suffixPrefixId"].ToString());
         isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(DecSalesInvoiceVoucherTypeId);
         cmbCashOrParty.SelectedValue = dtblMaster.Rows[0]["ledgerId"].ToString();
         cmbSalesAccount.SelectedValue = dtblMaster.Rows[0]["salesAccount"].ToString();
         cmbSalesMan.SelectedValue = dtblMaster.Rows[0]["employeeId"].ToString();
         txtCustomer.Text = dtblMaster.Rows[0]["customerName"].ToString();
         txtTransportCompany.Text = dtblMaster.Rows[0]["transportationCompany"].ToString();
         txtVehicleNo.Text = dtblMaster.Rows[0]["lrNo"].ToString();
         txtNarration.Text = dtblMaster.Rows[0]["narration"].ToString();
         cmbCurrency.SelectedValue = Convert.ToDecimal(dtblMaster.Rows[0]["exchangeRateId"].ToString());
         txtTotalAmount.Text = dtblMaster.Rows[0]["totalAmount"].ToString();
         lblTaxTotalAmount.Text = dtblMaster.Rows[0]["taxAmount"].ToString();
         cmbPricingLevel.SelectedValue = Convert.ToDecimal(dtblMaster.Rows[0]["pricingLevelId"].ToString());
         if (dtblMaster.Rows[0]["quotationMasterId"].ToString() != "0")
         {
             cmbSalesMode.Text = "Against Quotation";
             againstOrderComboFill();
             cmbSalesModeOrderNo.SelectedValue = dtblMaster.Rows[0]["quotationMasterId"].ToString();
             lblSalesModeOrderNo.Text = "Quotation No";
             cmbCurrency.Enabled = false;
             cmbPricingLevel.Enabled = false;
         }
         else if (dtblMaster.Rows[0]["orderMasterId"].ToString() != "0")
         {
             cmbSalesMode.Text = "Against SalesOrder";
             againstOrderComboFill();
             cmbSalesModeOrderNo.SelectedValue = dtblMaster.Rows[0]["orderMasterId"].ToString();
             lblSalesModeOrderNo.Text = "Order No";
             cmbCurrency.Enabled = false;
             cmbPricingLevel.Enabled = false;
         }
         else if (dtblMaster.Rows[0]["deliveryNoteMasterId"].ToString() != "0")
         {
             cmbSalesMode.Text = "Against Delivery Note";
             againstOrderComboFill();
             cmbSalesModeOrderNo.SelectedValue = dtblMaster.Rows[0]["deliveryNoteMasterId"].ToString();
             lblSalesModeOrderNo.Text = "Delivery Note No";
             cmbCurrency.Enabled = false;
             cmbPricingLevel.Enabled = false;
         }
         else
         {
             cmbSalesMode.SelectedText = "NA";
         }
         if (txtInvoiceNo.Enabled)
         {
             txtDate.Focus();
         }
         else
         {
             txtInvoiceNo.Focus();
         }
         DataTable dtblDetails = new DataTable();
         dtblDetails = spSalesDetails.SalesInvoiceSalesDetailsViewBySalesMasterId(decSalesInvoiceIdToEdit);
         dgvSalesInvoiceTaxComboFill();
         dgvSalesInvoice.Rows.Clear();
         for (int i = 0; i < dtblDetails.Rows.Count; i++)
         {
             dgvSalesInvoice.Rows.Add();
             IsSetGridValueChange = false;
             dgvSalesInvoice.Rows[i].HeaderCell.Value = string.Empty;
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["salesDetailsId"].ToString());
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSlno"].Value = dtblDetails.Rows[i]["slNo"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBarcode"].Value = dtblDetails.Rows[i]["barcode"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductCode"].Value = dtblDetails.Rows[i]["productCode"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductName"].Value = dtblDetails.Rows[i]["productName"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductId"].Value = dtblDetails.Rows[i]["productId"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBrand"].Value = dtblDetails.Rows[i]["brandName"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceQty"].Value = dtblDetails.Rows[i]["qty"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoicePurchaseRate"].Value = dtblDetails.Rows[i]["purchaseRate"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceAmount"].Value = dtblDetails.Rows[i]["amount"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceGrossValue"].Value = dtblDetails.Rows[i]["grossAmount"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoicembUnitName"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["unitId"].ToString());
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceRate"].Value = dtblDetails.Rows[i]["rate"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceGodown"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["godownId"].ToString());
             RackComboFill(Convert.ToDecimal(dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceGodown"].Value.ToString()), i, dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceRack"].ColumnIndex);
             dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceRack"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["rackId"].ToString());
             if (dtblDetails.Rows[i]["batchId"] != null && dtblDetails.Rows[i]["batchId"].ToString() != string.Empty)
             {
                 dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceBatch"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["batchId"].ToString());
             }
             else
             {
                 dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceBatch"].Value = string.Empty;
             }
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceMrp"].Value = dtblDetails.Rows[i]["mrp"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesRate"].Value = dtblDetails.Rows[i]["salesRate"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceDiscountAmount"].Value = dtblDetails.Rows[i]["discount"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceNetAmount"].Value = dtblDetails.Rows[i]["netAmount"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceTaxName"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["taxId"].ToString());
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceTaxAmount"].Value = dtblDetails.Rows[i]["taxAmount"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceUnitConversionId"].Value = dtblDetails.Rows[i]["unitConversionId"].ToString();
             lblTotalQuantitydisplay.Text = dtblDetails.Rows[i]["qty"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSISalesOrderDetailsId"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["orderDetailsId"].ToString());  // here get fill the grid colum for the editing prps
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceDeliveryNoteDetailsId"].Value = dtblDetails.Rows[i]["deliveryNoteDetailsId"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceQuotationDetailsId"].Value = dtblDetails.Rows[i]["quotationDetailsId"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["voucherTypeRefNo"].ToString());  // here get fill the grid colum for the editing prps
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherNo"].Value = dtblDetails.Rows[i]["voucherRefNo"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value = dtblDetails.Rows[i]["invoiceRefNo"].ToString();
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBarcode"].ReadOnly = true;
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductCode"].ReadOnly = true;
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductName"].ReadOnly = true;
             dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBrand"].ReadOnly = true;
             dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceBatch"].ReadOnly = true;
             if (cmbSalesMode.SelectedIndex != 0)
             {
                 strVoucherNoTostockPost = dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherNo"].Value.ToString();
                 strInvoiceNoTostockPost = dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value.ToString();
                 decVouchertypeIdTostockPost = Convert.ToDecimal(dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value);
             }
             GrossValueCalculation(i);
             DiscountCalculation(i, dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceDiscountAmount"].ColumnIndex);
             taxAndGridTotalAmountCalculation(i);
             decCurrentRate = Convert.ToDecimal(dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceRate"].Value.ToString());
             decCurrentConversionRate = Convert.ToDecimal(dtblDetails.Rows[i]["conversionRate"].ToString());
             UnitConversionCalc(i);
             if (cmbSalesModeOrderNo.Visible == true)
             {
                 dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoicembUnitName"].ReadOnly = true;
             }
         }
         DataTable dtblAdditionalCost = new DataTable();
         dtblAdditionalCost = spSalesMaster.SalesInvoiceAdditionalCostViewByVoucherNoUnderVoucherType(DecSalesInvoiceVoucherTypeId, strVoucherNo);
         for (int i = 0; i < dtblAdditionalCost.Rows.Count; i++)
         {
             dgvSalesInvoiceLedger.Rows.Add();
             dgvSalesInvoiceLedger.Rows[i].Cells["dgvtxtAdditionalCostId"].Value = dtblAdditionalCost.Rows[i]["additionalCostId"].ToString();
             dgvSalesInvoiceLedger.Rows[i].Cells["dgvCmbAdditionalCostledgerName"].Value = Convert.ToDecimal(dtblAdditionalCost.Rows[i]["ledgerId"].ToString());
             dgvSalesInvoiceLedger.Rows[i].Cells["dgvtxtAdditionalCoastledgerAmount"].Value = dtblAdditionalCost.Rows[i]["amount"].ToString();
             DataTable dtblAdcostForView = new DataTable();
             AccountLedgerSP SpAccountLedger = new AccountLedgerSP();
             dtblAdcostForView = SpAccountLedger.AccountLedgerViewForAdditionalCost();
             DataGridViewComboBoxCell dgvccVoucherType = (DataGridViewComboBoxCell)dgvSalesInvoiceLedger[dgvSalesInvoiceLedger.Columns["dgvCmbAdditionalCostledgerName"].Index, i];
             dgvccVoucherType.DataSource = dtblAdcostForView;
             dgvccVoucherType.ValueMember = "ledgerId";
             dgvccVoucherType.DisplayMember = "ledgerName";
         }
         DataTable dtblDrOrCr = spSalesMaster.salesinvoiceAdditionalCostCheckdrOrCrforSiEdit(DecSalesInvoiceVoucherTypeId, strVoucherNo);
         if (dtblDrOrCr.Rows.Count > 0)
         {
             if (Convert.ToDecimal(dtblDrOrCr.Rows[0]["credit"].ToString()) != 0)
             {
                 cmbCashOrbank.SelectedValue = Convert.ToDecimal(dtblDrOrCr.Rows[0]["ledgerId"].ToString());
                 cmbCashOrbank.Visible = true;
                 lblcashOrBank.Visible = true;
                 cmbDrorCr.SelectedIndex = 0;
                 decBankOrCashIdForEdit = Convert.ToDecimal(cmbCashOrbank.SelectedValue.ToString());
             }
             else
             {
                 cmbDrorCr.SelectedIndex = 1;
             }
         }
         taxGridFill();
         DataTable dtblTax = new DataTable();
         dtblTax = spSalesBillTax.SalesInvoiceSalesBillTaxViewAllBySalesMasterId(decSalesInvoiceIdToEdit);
         foreach (DataGridViewRow dgvrowTax in dgvSalesInvoiceTax.Rows)
         {
             for (int ini = 0; ini < dtblTax.Rows.Count; ini++)
             {
                 if (dgvrowTax.Cells["dgvtxtTtaxId"].Value != null && dgvrowTax.Cells["dgvtxtTtaxId"].Value.ToString() != string.Empty)
                 {
                     decimal decId = Convert.ToDecimal(dtblTax.Rows[ini]["taxId"].ToString());
                     if (dgvrowTax.Cells["dgvtxtTtaxId"].Value.ToString() == decId.ToString())
                     {
                         dgvrowTax.Cells["dgvtxtTtaxAmount"].Value = dtblTax.Rows[ini]["taxAmount"].ToString();
                         break;
                     }
                     else
                     {
                         dgvrowTax.Cells["dgvtxtTtaxAmount"].Value = "0.00";
                     }
                 }
             }
         }
         LedgerGridTotalAmountCalculation();
         SiGridTotalAmountCalculation();
         txtGrandTotal.Text = dtblMaster.Rows[0]["grandTotal"].ToString();
         txtBillDiscount.Text = dtblMaster.Rows[0]["billDiscount"].ToString();
         bool isPartyBalanceRef = false;
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         PartyBalanceSP spPartyBalance = new PartyBalanceSP();
         isPartyBalanceRef = spAccountLedger.PartyBalanceAgainstReferenceCheck(strVoucherNo, DecSalesInvoiceVoucherTypeId);
         if (isPartyBalanceRef)
         {
             cmbCashOrParty.Enabled = false;
         }
         else
         {
             cmbCashOrParty.Enabled = true;
         }
         //if (!spPartyBalance.PartyBalanceCheckReference(DecSalesInvoiceVoucherTypeId, strVoucherNo))
         //{
         //    cmbCashOrParty.Enabled = false;
         //}
         //else
         //{
         //    cmbCashOrParty.Enabled = true;
         //}
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI: 77" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 25
0
        /// <summary>
        /// fill the curresponding details for update
        /// </summary>
        public void TaxSelectionFillForUpdate()
        {
            try
            {
                int inRowCount = dgvTaxSelection.RowCount;
                for (int i = 0; i < inRowCount; i++)
                {
                    dgvTaxSelection.Rows[i].Cells["dgvcbxSelect"].Value = false;
                }
                decTaxId = Convert.ToDecimal(dgvTaxSearch.CurrentRow.Cells["dgvtxtTaxIdSearch"].Value.ToString());
                TaxInfo infoTax = new TaxInfo();
                TaxSP spTax = new TaxSP();
                TaxDetailsInfo infoTaxDetails = new TaxDetailsInfo();
                TaxDetailsSP spTaxDetails = new TaxDetailsSP();
                infoTax = spTax.TaxView(decTaxId);
                txtTaxName.Text = infoTax.TaxName;
                txtRate.Text = infoTax.Rate.ToString();
                cmbApplicableFor.Text = infoTax.ApplicableOn;
                cmbCalculationMode.Text = infoTax.CalculatingMode;
                txtNarration.Text = infoTax.Narration;
                if (infoTax.IsActive.ToString() == "True")
                {
                    cbxActive.Checked = true;
                }
                else
                {
                    cbxActive.Checked = false;
                }
                strTaxName = infoTax.TaxName;
                decTaxIdForEdit = infoTax.TaxId;
                btnSave.Text = "Update";
                btnDelete.Enabled = true;
                DataTable dtbl = new DataTable();
                dtbl = spTax.TaxIdForTaxSelectionUpdate(decTaxId);
                foreach (DataRow dr in dtbl.Rows)
                {
                    string strTaxId = dr["selectedtaxId"].ToString();
                    for (int i = 0; i < inRowCount; i++)
                    {
                        if (dgvTaxSelection.Rows[i].Cells["dgvtxtTaxId"].Value.ToString() == strTaxId)
                        {
                            dgvTaxSelection.Rows[i].Cells["dgvcbxSelect"].Value = true;
                        }
                    }
                }

                AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                decLedgerId = spAccountLedger.AccountLedgerIdGetByName(txtTaxName.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show("TC10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 26
0
 /// <summary>
 /// Cash or party combo changed, call the order combofill function and fill the basic functions
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmbCashOrParty_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         GetSalesDetailsIdToDelete();
         AccountLedgerSP SpAccountLedger = new AccountLedgerSP();
         AccountLedgerInfo InfoAccountLedger = new AccountLedgerInfo();
         if (isFromEditMode == false)
         {
             if (cmbCashOrParty.Text != string.Empty)
             {
                 if (cmbCashOrParty.SelectedValue.ToString() != "System.Data.DataRowView" && cmbCashOrParty.Text != "System.Data.DataRowView")
                 {
                     InfoAccountLedger = SpAccountLedger.accountLedgerviewbyId(Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()));
                     txtCustomer.Text = InfoAccountLedger.LedgerName;
                     cmbPricingLevel.SelectedValue = InfoAccountLedger.PricinglevelId == 0 ? 1 : InfoAccountLedger.PricinglevelId;
                     if (InfoAccountLedger.PricinglevelId == 0)
                     {
                         cmbPricingLevel.SelectedIndex = 0;
                     }
                     txtCreditPeriod.Text = InfoAccountLedger.CreditPeriod.ToString();
                 }
             }
         }
         else if (cmbSalesMode.SelectedIndex != 0)
         {
             Clear();
         }
         againstOrderComboFill();
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI: 98" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 27
0
 /// <summary>
 /// editing the ledger on update
 /// </summary>
 public void LedgerEdit()
 {
     try
     {
         AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo();
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         infoAccountLedger.LedgerId = decLedgerId;
         infoAccountLedger.AccountGroupId = 20;
         infoAccountLedger.LedgerName = txtTaxName.Text;
         infoAccountLedger.OpeningBalance = 0;
         infoAccountLedger.IsDefault = false;
         infoAccountLedger.CrOrDr = "Cr";
         infoAccountLedger.Narration = string.Empty;
         infoAccountLedger.MailingName = txtTaxName.Text;
         infoAccountLedger.Address = string.Empty;
         infoAccountLedger.Phone = string.Empty;
         infoAccountLedger.Mobile = string.Empty;
         infoAccountLedger.Email = string.Empty;
         infoAccountLedger.CreditPeriod = 0;
         infoAccountLedger.CreditLimit = 0;
         infoAccountLedger.PricinglevelId = 0;
         infoAccountLedger.BillByBill = false;
         infoAccountLedger.Tin = string.Empty;
         infoAccountLedger.Cst = string.Empty;
         infoAccountLedger.Pan = string.Empty;
         infoAccountLedger.RouteId = 1;
         infoAccountLedger.BankAccountNumber = string.Empty;
         infoAccountLedger.BranchCode = string.Empty;
         infoAccountLedger.BranchName = string.Empty;
         infoAccountLedger.ExtraDate = DateTime.Now;
         infoAccountLedger.Extra1 = string.Empty;
         infoAccountLedger.Extra2 = string.Empty;
         infoAccountLedger.AreaId = 1;
         spAccountLedger.AccountLedgerEdit(infoAccountLedger);
     }
     catch(Exception ex)
     {
         MessageBox.Show("TAX:13" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 28
0
        /// <summary>
        /// Function to call the SaveOrEditFunction after checking negative balance 
        /// </summary>
        public void SaveOrEdit()
        {
            try
            {
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
                {
                    JournalMasterSP spJournalMaster = new JournalMasterSP();
                    //=====================================================
                    SettingsSP spSettings = new SettingsSP();
                    string strStatus = spSettings.SettingsStatusCheck("NegativeCashTransaction");
                    decimal decBalance = 0;
                    decimal decCalcAmount = 0;
                    AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                    bool isNegativeLedger = false;
                    int inRowCount = dgvJournalVoucher.RowCount;
                    for (int i = 0; i < inRowCount - 1; i++)
                    {
                        decimal decledgerId = 0;
                        if (dgvJournalVoucher.Rows[i].Cells["dgvcmbAccountLedger"].Value != null && dgvJournalVoucher.Rows[i].Cells["dgvcmbAccountLedger"].Value.ToString() != string.Empty)
                        {
                            decledgerId = Convert.ToDecimal(dgvJournalVoucher.Rows[i].Cells["dgvcmbAccountLedger"].Value.ToString());

                            decBalance = spAccountLedger.CheckLedgerBalance(decledgerId);
                            if (dgvJournalVoucher.Rows[i].Cells["dgvtxtAmount"].Value != null && dgvJournalVoucher.Rows[i].Cells["dgvtxtAmount"].Value.ToString() != string.Empty)
                            {
                                decCalcAmount = decBalance - Convert.ToDecimal(dgvJournalVoucher.Rows[i].Cells["dgvtxtAmount"].Value.ToString());
                            }
                            if (decCalcAmount < 0)
                            {
                                isNegativeLedger = true;
                                break;
                            }
                        }
                    }
                    //=========================================
                    if (isNegativeLedger)
                    {

                        if (strStatus == "Warn")
                        {
                            if (MessageBox.Show("Negative balance exists,Do you want to Continue", "Open miracle", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                            {
                                SaveOrEditFunction();
                            }
                        }
                        else if (strStatus == "Block")
                        {
                            MessageBox.Show("Cannot continue ,due to negative balance", "Open miracle", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        }
                        else
                        {
                            SaveOrEditFunction();
                        }
                    }
                    else
                    {
                        SaveOrEditFunction();
                    }

                }
                else
                {
                    Messages.NoPrivillageMessage();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("JV18:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 29
0
 /// <summary>
 /// Function to fill additional cost
 /// </summary>
 public void AdditionalCostComboFill()
 {
     try
     {
         DataTable dtbl = new DataTable();
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         dtbl = spAccountLedger.AdditionalCostGet();
         dgvcmbAdditionalCostLedger.DataSource = dtbl;
         dgvcmbAdditionalCostLedger.ValueMember = "ledgerId";
         dgvcmbAdditionalCostLedger.DisplayMember = "ledgerName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("SJ:25" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 30
0
 /// <summary>
 /// Function to add the new accountledger from accountLedger form
 /// </summary>
 /// <param name="decLedgerId"></param>
 public void CallFromAccountLedger(decimal decLedgerId)
 {
     try
     {
         if (decLedgerId != 0)
         {
             AccountLedgerSP spAccountLedger = new AccountLedgerSP();
             DataTable dtbl = new DataTable();
             dtbl = spAccountLedger.AccountLedgerViewAll();
             DataGridViewComboBoxCell dgvccAccountLedger = (DataGridViewComboBoxCell)dgvJournalVoucher[dgvJournalVoucher.Columns["dgvcmbAccountLedger"].Index, dgvJournalVoucher.CurrentRow.Index];
             dgvccAccountLedger.DataSource = dtbl;
             dgvccAccountLedger.ValueMember = "ledgerId";
             dgvccAccountLedger.DisplayMember = "ledgerName";
             dgvJournalVoucher.CurrentRow.Cells["dgvcmbAccountLedger"].Value = decLedgerId;
         }
         dgvJournalVoucher.Focus();
         this.Enabled = true;
         this.BringToFront();
     }
     catch (Exception ex)
     {
         MessageBox.Show("JV30:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }