예제 #1
0
        /// <summary>
        /// Function to fill the report in grid
        /// </summary>
        public void GridFill()
        {
            decimal decBalanceTotal = 0;

            try
            {
                AccountGroupSP spAccountGroup = new AccountGroupSP();
                DataTable      dtbl           = new DataTable();

                dtbl = spAccountGroup.AccountGroupWiseReportViewAll(decAccountGroupId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text));
                if (decAccountGroupId == 6)
                {
                    FinancialStatementSP spFinace = new FinancialStatementSP();
                    CalculationMethod();
                    decimal dcOpeninggStock = spFinace.StockValueGetOnDate(PublicVariables._dtFromDate, calculationMethod, true, true);
                    dcOpeninggStock = Math.Round(dcOpeninggStock, PublicVariables._inNoOfDecimalPlaces);
                    int     inRowCount = dtbl.Rows.Count;
                    DataRow dr         = dtbl.NewRow();
                    dr["SlNo"]           = inRowCount + 1;
                    dr["accountGroupId"] = -2;
                    dr["ledgerId"]       = 0;
                    dr["name"]           = "Opening Stock";
                    if (dcOpeninggStock >= 0)
                    {
                        dr["OpeningBalance"] = dcOpeninggStock + "Dr";
                        dr["Balance"]        = dcOpeninggStock + "Dr";
                    }
                    else
                    {
                        dr["OpeningBalance"] = dcOpeninggStock + "Cr";
                        dr["Balance"]        = dcOpeninggStock + "Cr";
                    }
                    dr["debit"]    = Math.Round(Convert.ToDecimal(0.00000), PublicVariables._inNoOfDecimalPlaces).ToString() + ".00";
                    dr["credit"]   = Math.Round(Convert.ToDecimal(0.00000), PublicVariables._inNoOfDecimalPlaces).ToString() + ".00";
                    dr["balance1"] = dcOpeninggStock;
                    dtbl.Rows.InsertAt(dr, inRowCount);
                }
                dgvAccountGroupWiseReport.DataSource = dtbl;
                if (dtbl.Rows.Count > 0)
                {
                    for (int i = 0; i < dgvAccountGroupWiseReport.RowCount; i++)
                    {
                        decBalanceTotal += Convert.ToDecimal(dgvAccountGroupWiseReport.Rows[i].Cells["balance1"].Value.ToString());
                    }
                }
                if (decBalanceTotal < 0)
                {
                    decBalanceTotal      = -1 * decBalanceTotal;
                    lblBalanceTotal.Text = decBalanceTotal.ToString() + "Cr";
                }
                else
                {
                    lblBalanceTotal.Text = decBalanceTotal.ToString() + "Dr";
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "AGWREP2:" + ex.Message;
            }
        }
예제 #2
0
 /// <summary>
 /// Function to print report
 /// </summary>
 /// <param name="fromDate"></param>
 /// <param name="toDate"></param>
 public void Print(DateTime fromDate, DateTime toDate)
 {
     try
     {
         FinancialStatementSP spFinance = new FinancialStatementSP();
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         DataSet dsAccountGroup = new DataSet();
         DataTable dtblAccountGroup = spAccountGroup.AccountGroupReportFill(fromDate, toDate);
         string strSum = lblBalanceTotal.Text;
         DataTable dtblSum = new DataTable();
         dtblSum.Columns.Add("Sum", typeof(string));
         DataRow dr = dtblSum.NewRow();
         dr[0] = strSum;
         dtblSum.Rows.InsertAt(dr, 0);
         
         DataTable dtblCompany = spFinance.FundFlowReportPrintCompany(1);
         dsAccountGroup.Tables.Add(dtblAccountGroup);
         dsAccountGroup.Tables.Add(dtblCompany);
         dsAccountGroup.Tables.Add(dtblSum);
         frmReport frmReport = new frmReport();
         frmReport.MdiParent = formMDI.MDIObj;
         frmReport.AccountGroup(dsAccountGroup);
     }
     catch (Exception ex)
     {
         MessageBox.Show("AGR:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #3
0
 /// <summary>
 /// on combobox account group text changing
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmbAccountGroup_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (isLoad)
         {
             int            index          = cmbAccountGroup.SelectedIndex;
             string         strinr         = cmbAccountGroup.Text.ToString();
             int            dec            = cmbAccountGroup.SelectedIndex;
             int            inRowcount     = dgvMultipleAccountLedger.RowCount;
             AccountGroupSP spAccountGroup = new AccountGroupSP();
             string         strNature;
             strNature = spAccountGroup.MultipleAccountLedgerCrOrDr(cmbAccountGroup.Text);
             for (int i = 0; i < inRowcount; i++)
             {
                 if (strNature == "Assets" || strNature == "Income")
                 {
                     dgvMultipleAccountLedger.Rows[i].Cells["dgvcmbDebitOrCredit"].Value = "Cr";
                 }
                 else if (strNature == "Expenses" || strNature == "Liabilities")
                 {
                     dgvMultipleAccountLedger.Rows[i].Cells["dgvcmbDebitOrCredit"].Value = "Dr";
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MAL12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill the report in grid
 /// </summary>
 public void GridFill()
 {
     decimal decBalanceTotal = 0;
     try
     {
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         DataTable dtbl = new DataTable();
         
         dtbl = spAccountGroup.AccountGroupWiseReportViewAll(decAccountGroupId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text));
         if (decAccountGroupId == 6)
         {
             FinancialStatementSP spFinace = new FinancialStatementSP();
             CalculationMethod();
             decimal dcOpeninggStock = spFinace.StockValueGetOnDate(PublicVariables._dtFromDate, calculationMethod, true, true);
             dcOpeninggStock = Math.Round(dcOpeninggStock, PublicVariables._inNoOfDecimalPlaces);
             int inRowCount=dtbl.Rows.Count;
             DataRow dr = dtbl.NewRow();
             dr["SlNo"] = inRowCount+1;
             dr["accountGroupId"] = -2;
             dr["ledgerId"] = 0;
             dr["name"] = "Opening Stock";
             if (dcOpeninggStock >= 0)
             {
                 dr["OpeningBalance"] = dcOpeninggStock + "Dr";
                 dr["Balance"] = dcOpeninggStock + "Dr";
             }
             else
             {
                 dr["OpeningBalance"] = dcOpeninggStock + "Cr";
                 dr["Balance"] = dcOpeninggStock + "Cr";
             }
             dr["debit"] = Math.Round(Convert.ToDecimal(0.00000), PublicVariables._inNoOfDecimalPlaces).ToString()+".00" ;
             dr["credit"] = Math.Round(Convert.ToDecimal(0.00000), PublicVariables._inNoOfDecimalPlaces).ToString()+".00";
             dr["balance1"] = dcOpeninggStock;
             dtbl.Rows.InsertAt(dr, inRowCount);
         }
         dgvAccountGroupWiseReport.DataSource = dtbl;
         if (dtbl.Rows.Count > 0)
         {
             for (int i = 0; i < dgvAccountGroupWiseReport.RowCount; i++)
             {
                 decBalanceTotal += Convert.ToDecimal(dgvAccountGroupWiseReport.Rows[i].Cells["balance1"].Value.ToString());
                 
             }   
         }
         if (decBalanceTotal < 0)
         {
             decBalanceTotal = -1 * decBalanceTotal;
             lblBalanceTotal.Text = decBalanceTotal.ToString() + "Cr";
         }
         else
         {
             lblBalanceTotal.Text = decBalanceTotal.ToString()+"Dr";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AGWREP02:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #5
0
        /// <summary>
        /// Function to print report
        /// </summary>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        public void Print(DateTime fromDate, DateTime toDate)
        {
            try
            {
                FinancialStatementSP spFinance      = new FinancialStatementSP();
                AccountGroupSP       spAccountGroup = new AccountGroupSP();
                DataSet   dsAccountGroup            = new DataSet();
                DataTable dtblAccountGroup          = spAccountGroup.AccountGroupReportFill(fromDate, toDate);
                string    strSum  = lblBalanceTotal.Text;
                DataTable dtblSum = new DataTable();
                dtblSum.Columns.Add("Sum", typeof(string));
                DataRow dr = dtblSum.NewRow();
                dr[0] = strSum;
                dtblSum.Rows.InsertAt(dr, 0);

                DataTable dtblCompany = spFinance.FundFlowReportPrintCompany(1);
                dsAccountGroup.Tables.Add(dtblAccountGroup);
                dsAccountGroup.Tables.Add(dtblCompany);
                dsAccountGroup.Tables.Add(dtblSum);
                frmReport frmReport = new frmReport();
                frmReport.MdiParent = formMDI.MDIObj;
                frmReport.AccountGroup(dsAccountGroup);
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "AGR1:" + ex.Message;
            }
        }
예제 #6
0
        /// <summary>
        /// Function to call from CashFlow for current asset grid fill
        /// </summary>
        public void CashOutflowCurrentAssetGridFill()
        {
            decimal decBalanceTotal = 0;

            try
            {
                AccountGroupSP spAccountGroup = new AccountGroupSP();
                DataTable      dtbl           = new DataTable();
                dtbl = spAccountGroup.CashOutflowCurrentAssetAccountGroupWiseReportViewAll(decAccountGroupId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text));
                dgvAccountGroupWiseReport.DataSource = dtbl;
                if (dtbl.Rows.Count > 0)
                {
                    for (int i = 0; i < dgvAccountGroupWiseReport.RowCount; i++)
                    {
                        decBalanceTotal += Convert.ToDecimal(dgvAccountGroupWiseReport.Rows[i].Cells["balance1"].Value.ToString());
                    }
                }
                if (decBalanceTotal < 0)
                {
                    decBalanceTotal      = -1 * decBalanceTotal;
                    lblBalanceTotal.Text = decBalanceTotal.ToString() + "Cr";
                }
                else
                {
                    lblBalanceTotal.Text = decBalanceTotal.ToString() + "Dr";
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "AGWREP11:" + ex.Message;
            }
        }
        /// <summary>
        /// Function to call from CashFlow
        /// </summary>
        public void CashflowLoansGridFill()
        {
            decimal decBalanceTotal = 0;

            try
            {
                AccountGroupSP spAccountGroup = new AccountGroupSP();
                DataTable      dtbl           = new DataTable();
                dtbl = spAccountGroup.CashInflowLoansAccountGroupWiseReportViewAll(decAccountGroupId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text));
                dgvAccountGroupWiseReport.DataSource = dtbl;
                if (dtbl.Rows.Count > 0)
                {
                    for (int i = 0; i < dgvAccountGroupWiseReport.RowCount; i++)
                    {
                        decBalanceTotal += Convert.ToDecimal(dgvAccountGroupWiseReport.Rows[i].Cells["balance1"].Value.ToString());
                    }
                }
                if (decBalanceTotal < 0)
                {
                    decBalanceTotal      = -1 * decBalanceTotal;
                    lblBalanceTotal.Text = decBalanceTotal.ToString() + "Cr";
                }
                else
                {
                    lblBalanceTotal.Text = decBalanceTotal.ToString() + "Dr";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("AGWREP10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #8
0
 /// <summary>
 /// Function to fill accountgroup combobox
 /// </summary>
 /// <param name="cmbAccountGroup"></param>
 public void AccountGroupComboFill(ComboBox cmbAccountGroup)
 {
     try
     {
         cmbAccountGroup.Enabled = true;
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         spAccountGroup.BillAllocationAccountGroupFill(cmbAccountGroup, true);
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "BA2:" + ex.Message;
     }
 }
예제 #9
0
 /// <summary>
 /// Function to fill accountgroup combobox
 /// </summary>
 /// <param name="cmbAccountGroup"></param>
 public void AccountGroupComboFill(ComboBox cmbAccountGroup)
 {
     try
     {
         cmbAccountGroup.Enabled = true;
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         spAccountGroup.BillAllocationAccountGroupFill(cmbAccountGroup, true);
     }
     catch (Exception ex)
     {
         MessageBox.Show("BA:02" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #10
0
 /// <summary>
 /// Function to fill accountgroup combobox
 /// </summary>
 /// <param name="cmbAccountGroup"></param>
 public void AccountGroupComboFill(ComboBox cmbAccountGroup)
 {
     try
     {
         cmbAccountGroup.Enabled = true;
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         spAccountGroup.BillAllocationAccountGroupFill(cmbAccountGroup, true);
     }
     catch (Exception ex)
     {
         MessageBox.Show("BA:02" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #11
0
 /// <summary>
 /// Function to delete account group
 /// </summary>
 public void Delete()
 {
     try
     {
         if (isDefault == true)
         {
             Messages.InformationMessage("Can't delete build in account group");
         }
         //else if (PublicVariables.isMessageDelete)
         //{
         else if (Messages.DeleteConfirmation())
         {
             AccountGroupInfo InfoAccountGroup = new AccountGroupInfo();
             AccountGroupSP   spAccountGroup   = new AccountGroupSP();
             if ((spAccountGroup.AccountGroupReferenceDelete(decAccountGroupIdForEdit) == -1))
             {
                 Messages.ReferenceExistsMessage();
             }
             else
             {
                 Messages.DeletedMessage();
                 btnSave.Text      = "Save";
                 btnDelete.Enabled = false;
                 Clear();
             }
         }
         //}
         //else
         //{
         //    AccountGroupInfo InfoAccountGroup = new AccountGroupInfo();
         //    AccountGroupSP spAccountGroup = new AccountGroupSP();
         //    if ((spAccountGroup.AccountGroupReferenceDelete(decAccountGroupIdForEdit) == -1))
         //    {
         //        Messages.ReferenceExistsMessage();
         //    }
         //    else
         //    {
         //        Messages.DeletedMessage();
         //        btnSave.Text = "Save";
         //        btnDelete.Enabled = false;
         //        Clear();
         //    }
         //}
     }
     catch (Exception ex)
     {
         MessageBox.Show("AG10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #12
0
 /// <summary>
 /// Function to delete account group
 /// </summary>
 public void Delete()
 {
     try
     {
         if (isDefault == true)
         {
             Messages.InformationMessage("Can't delete build in account group");
         }
         //else if (PublicVariables.isMessageDelete)
         //{
         else if (Messages.DeleteConfirmation())
         {
             AccountGroupInfo InfoAccountGroup = new AccountGroupInfo();
             AccountGroupSP   spAccountGroup   = new AccountGroupSP();
             if ((spAccountGroup.AccountGroupReferenceDelete(decAccountGroupIdForEdit) == -1))
             {
                 Messages.ReferenceExistsMessage();
             }
             else
             {
                 Messages.DeletedMessage();
                 btnSave.Text      = "Save";
                 btnDelete.Enabled = false;
                 Clear();
             }
         }
         //}
         //else
         //{
         //    AccountGroupInfo InfoAccountGroup = new AccountGroupInfo();
         //    AccountGroupSP spAccountGroup = new AccountGroupSP();
         //    if ((spAccountGroup.AccountGroupReferenceDelete(decAccountGroupIdForEdit) == -1))
         //    {
         //        Messages.ReferenceExistsMessage();
         //    }
         //    else
         //    {
         //        Messages.DeletedMessage();
         //        btnSave.Text = "Save";
         //        btnDelete.Enabled = false;
         //        Clear();
         //    }
         //}
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "AG7:" + ex.Message;
     }
 }
예제 #13
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)
     {
         formMDI.infoError.ErrorString = "COA1:" + ex.Message;
     }
 }
예제 #14
0
        private void cmbGroupUnder_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (cmbGroupUnder.SelectedValue != null && cmbGroupUnder.SelectedValue.ToString() != "System.Data.DataRowView")
                {
                    decimal          decAccountGroupId = Convert.ToDecimal(cmbGroupUnder.SelectedValue.ToString());
                    AccountGroupSP   spAccountGroup    = new AccountGroupSP();
                    AccountGroupInfo infoAccountGroup  = new AccountGroupInfo();
                    infoAccountGroup = spAccountGroup.AccountGroupView(decAccountGroupId);
                    string strNature = infoAccountGroup.Nature;
                    string strIsAffectGrossProfit = infoAccountGroup.AffectGrossProfit;
                    // string strNature = spAccountGroup.AccountGroupNatureUnderGroup(decAccountGroupId);
                    if (strNature != "NA")
                    {
                        cmbNature.Text = strNature;
                        if (infoAccountGroup.AffectGrossProfit == "1")
                        {
                            cmbAffectGrossProfit.SelectedIndex = 0;
                        }
                        else
                        {
                            cmbAffectGrossProfit.SelectedIndex = 1;
                        }
                        cmbNature.Enabled            = false;
                        cmbAffectGrossProfit.Enabled = false;
                    }
                    else
                    {
                        cmbNature.Enabled            = true;
                        cmbAffectGrossProfit.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "AG24:" + ex.Message;
            }
            //if (txtAccountGroupName.Text != null && txtAccountGroupName.Text != string.Empty)
            //{


            //}
            //else
            //{
            //    cmbNature.Enabled = true;
            //}
        }
예제 #15
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);
     }
 }
예제 #16
0
 /// <summary>
 /// Function to fill account group combo
 /// </summary>
 public void GroupUnderComboFill()
 {
     try
     {
         AccountGroupSP spAccountGroup   = new AccountGroupSP();
         DataTable      dtblEmployeeCode = new DataTable();
         dtblEmployeeCode            = spAccountGroup.AccountGroupViewAllComboFill();
         cmbGroupUnder.DataSource    = dtblEmployeeCode;
         cmbGroupUnder.ValueMember   = "accountGroupId";
         cmbGroupUnder.DisplayMember = "accountGroupName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("AG2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #17
0
 /// <summary>
 /// Function to fill account group combo
 /// </summary>
 public void GroupUnderComboFill()
 {
     try
     {
         AccountGroupSP spAccountGroup   = new AccountGroupSP();
         DataTable      dtblEmployeeCode = new DataTable();
         dtblEmployeeCode            = spAccountGroup.AccountGroupViewAllComboFill();
         cmbGroupUnder.DataSource    = dtblEmployeeCode;
         cmbGroupUnder.ValueMember   = "accountGroupId";
         cmbGroupUnder.DisplayMember = "accountGroupName";
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "AG2:" + ex.Message;
     }
 }
예제 #18
0
 /// <summary>
 /// Function to fill account group combo
 /// </summary>
 public void GroupUnderComboFill()
 {
     try
     {
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         DataTable dtblEmployeeCode = new DataTable();
         dtblEmployeeCode = spAccountGroup.AccountGroupViewAllComboFill();
         cmbGroupUnder.DataSource = dtblEmployeeCode;
         cmbGroupUnder.ValueMember = "accountGroupId";
         cmbGroupUnder.DisplayMember = "accountGroupName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("AG2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #19
0
 /// <summary>
 /// Function to fill master grid
 /// </summary>
 public void GridFill()
 {
     try
     {
         DataTable dtblAccountName = new DataTable();
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         if (cmbGroupUnderSearch.Text.Trim() == string.Empty)
         {
             cmbGroupUnderSearch.Text = "All";
         }
         dtblAccountName = spAccountGroup.AccountGroupSearch(txtAccountGroupNameSearch.Text.Trim(), cmbGroupUnderSearch.Text);
         dgvAccountGroup.DataSource = dtblAccountName;
     }
     catch (Exception ex)
     {
         MessageBox.Show("AG1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #20
0
 /// <summary>
 /// Function to fill master grid
 /// </summary>
 public void GridFill()
 {
     try
     {
         DataTable      dtblAccountName = new DataTable();
         AccountGroupSP spAccountGroup  = new AccountGroupSP();
         if (cmbGroupUnderSearch.Text.Trim() == string.Empty)
         {
             cmbGroupUnderSearch.Text = "All";
         }
         dtblAccountName            = spAccountGroup.AccountGroupSearch(txtAccountGroupNameSearch.Text.Trim(), cmbGroupUnderSearch.Text);
         dgvAccountGroup.DataSource = dtblAccountName;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "AG1:" + ex.Message;
     }
 }
예제 #21
0
 /// <summary>
 /// Function to fill master grid
 /// </summary>
 public void GridFill()
 {
     try
     {
         DataTable      dtblAccountName = new DataTable();
         AccountGroupSP spAccountGroup  = new AccountGroupSP();
         if (cmbGroupUnderSearch.Text.Trim() == string.Empty)
         {
             cmbGroupUnderSearch.Text = "All";
         }
         dtblAccountName            = spAccountGroup.AccountGroupSearch(txtAccountGroupNameSearch.Text.Trim(), cmbGroupUnderSearch.Text);
         dgvAccountGroup.DataSource = dtblAccountName;
     }
     catch (Exception ex)
     {
         MessageBox.Show("AG1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #22
0
 /// <summary>
 /// Function to fill account group combo for Search
 /// </summary>
 public void GroupUnderSearchComboFill()
 {
     try
     {
         AccountGroupSP spAccountGroup   = new AccountGroupSP();
         DataTable      dtblEmployeeCode = new DataTable();
         dtblEmployeeCode = spAccountGroup.AccountGroupViewAllComboFill();
         DataRow dr = dtblEmployeeCode.NewRow();
         dr[1] = "All";
         dtblEmployeeCode.Rows.InsertAt(dr, 0);
         cmbGroupUnderSearch.DataSource    = dtblEmployeeCode;
         cmbGroupUnderSearch.ValueMember   = "accountGroupId";
         cmbGroupUnderSearch.DisplayMember = "accountGroupName";
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "AG3:" + ex.Message;
     }
 }
예제 #23
0
        /// <summary>
        /// Function to fill the report in grid for fundflow
        /// </summary>
        /// <param name="decCS"></param>
        public void GridFillForFundFlow(decimal decCS)
        {
            decimal decBalanceTotal = 0;

            try
            {
                AccountGroupSP spAccountGroup = new AccountGroupSP();
                DataTable      dtbl           = new DataTable();
                dtbl = spAccountGroup.AccountGroupWiseReportViewAll(decAccountGroupId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text));
                DataRow drow    = dtbl.NewRow();
                decimal decCsop = 0;
                drow[1] = -2;
                drow[2] = 0;
                drow[3] = "Closing Stock";
                drow[4] = decCsop.ToString() + ".00Dr";
                drow[5] = decCS;
                drow[6] = "0.00";
                drow[7] = decCS.ToString() + "Dr";
                drow[8] = decCS.ToString();
                dtbl.Rows.InsertAt(drow, dtbl.Rows.Count);
                dgvAccountGroupWiseReport.DataSource = dtbl;
                if (dtbl.Rows.Count > 0)
                {
                    for (int i = 0; i < dgvAccountGroupWiseReport.RowCount; i++)
                    {
                        decBalanceTotal += Convert.ToDecimal(dgvAccountGroupWiseReport.Rows[i].Cells["balance1"].Value.ToString());
                    }
                }
                if (decBalanceTotal < 0)
                {
                    decBalanceTotal      = -1 * decBalanceTotal;
                    lblBalanceTotal.Text = decBalanceTotal.ToString() + "Cr";
                }
                else
                {
                    lblBalanceTotal.Text = decBalanceTotal.ToString() + "Dr";
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "AGWREP3:" + ex.Message;
            }
        }
예제 #24
0
 /// <summary>
 /// Function to fill account group combo for Search
 /// </summary>
 public void GroupUnderSearchComboFill()
 {
     try
     {
         AccountGroupSP spAccountGroup   = new AccountGroupSP();
         DataTable      dtblEmployeeCode = new DataTable();
         dtblEmployeeCode = spAccountGroup.AccountGroupViewAllComboFill();
         DataRow dr = dtblEmployeeCode.NewRow();
         dr[1] = "All";
         dtblEmployeeCode.Rows.InsertAt(dr, 0);
         cmbGroupUnderSearch.DataSource    = dtblEmployeeCode;
         cmbGroupUnderSearch.ValueMember   = "accountGroupId";
         cmbGroupUnderSearch.DisplayMember = "accountGroupName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("AG3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill the accountgroup combo box
 /// </summary>
 public void AccountGroupComboFill()
 {
     try
     {
         AccountGroupSP spAccountGroup   = new AccountGroupSP();
         DataTable      dtblAccountGroup = new DataTable();
         dtblAccountGroup = spAccountGroup.AccountGroupViewAllComboFillForAccountLedger();
         DataRow dr = dtblAccountGroup.NewRow();
         dr["accountGroupName"] = "All";
         dr["accountGroupId"]   = -1;
         dtblAccountGroup.Rows.InsertAt(dr, 0);
         cmbAccountGroup.DataSource    = dtblAccountGroup;
         cmbAccountGroup.ValueMember   = "accountGroupId";
         cmbAccountGroup.DisplayMember = "accountGroupName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("ALREP2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #26
0
 /// <summary>
 /// Function to fill the accountgroup combo box
 /// </summary>
 public void AccountGroupComboFill()
 {
     try
     {
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         DataTable dtblAccountGroup = new DataTable();
         dtblAccountGroup = spAccountGroup.AccountGroupViewAllComboFillForAccountLedger();
         DataRow dr = dtblAccountGroup.NewRow();
         dr["accountGroupName"] = "All";
         dr["accountGroupId"] = -1;
         dtblAccountGroup.Rows.InsertAt(dr, 0);
         cmbAccountGroup.DataSource = dtblAccountGroup;
         cmbAccountGroup.ValueMember = "accountGroupId";
         cmbAccountGroup.DisplayMember = "accountGroupName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("ALREP2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #27
0
 /// <summary>
 /// Function to fill the accountgroup combo box
 /// </summary>
 public void AccountGroupComboFill()
 {
     try
     {
         AccountGroupSP spAccountGroup   = new AccountGroupSP();
         DataTable      dtblAccountGroup = new DataTable();
         dtblAccountGroup = spAccountGroup.AccountGroupViewAllComboFillForAccountLedger();
         DataRow dr = dtblAccountGroup.NewRow();
         dr["accountGroupName"] = "All";
         dr["accountGroupId"]   = -1;
         dtblAccountGroup.Rows.InsertAt(dr, 0);
         cmbAccountGroup.DataSource    = dtblAccountGroup;
         cmbAccountGroup.ValueMember   = "accountGroupId";
         cmbAccountGroup.DisplayMember = "accountGroupName";
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "ALREP2:" + ex.Message;
     }
 }
예제 #28
0
 /// <summary>
 /// On print button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvCashOrBank.Rows.Count > 0)
         {
             AccountGroupSP spAccountGroup = new AccountGroupSP();
             DataSet        dsCashBankBook = spAccountGroup.CashBankBookPrinting(1, this.dtpFromDate.Value, this.dtpToDate.Value, true);
             frmReport      frmReport      = new frmReport();
             frmReport.MdiParent = formMDI.MDIObj;
             frmReport.CashBankBookPrinting(dsCashBankBook);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CBBOOK09 :" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #29
0
 /// <summary>
 /// On print button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvCashOrBank.Rows.Count > 0)
         {
             AccountGroupSP spAccountGroup = new AccountGroupSP();
             DataSet        dsCashBankBook = spAccountGroup.CashBankBookPrinting(1, this.dtpFromDate.Value, this.dtpToDate.Value, true);
             frmReport      frmReport      = new frmReport();
             frmReport.MdiParent = formMDI.MDIObj;
             frmReport.CashBankBookPrinting(dsCashBankBook);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "CBBOOK9:" + ex.Message;
     }
 }
예제 #30
0
        /// <summary>
        /// Function to check existance of account group in DataBase
        /// </summary>
        /// <returns></returns>
        public bool CheckExistanceOfGroupName()
        {
            bool isExist = false;

            try
            {
                //Check whether a group name already exist in DB
                AccountGroupSP spAccountGroup = new AccountGroupSP();
                isExist = spAccountGroup.AccountGroupCheckExistence(txtAccountGroupName.Text.Trim(), 0);
                if (isExist)
                {
                    if (txtAccountGroupName.Text.ToLower() == strAccountGroupName.ToLower())
                    {
                        isExist = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("AG5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(isExist);
        }
예제 #31
0
        /// <summary>
        /// Function to check existance of account group in DataBase
        /// </summary>
        /// <returns></returns>
        public bool CheckExistanceOfGroupName()
        {
            bool isExist = false;

            try
            {
                //Check whether a group name already exist in DB
                AccountGroupSP spAccountGroup = new AccountGroupSP();
                isExist = spAccountGroup.AccountGroupCheckExistence(txtAccountGroupName.Text.Trim(), 0);
                if (isExist)
                {
                    if (txtAccountGroupName.Text.ToLower() == strAccountGroupName.ToLower())
                    {
                        isExist = false;
                    }
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "AG5:" + ex.Message;
            }
            return(isExist);
        }
예제 #32
0
 /// <summary>
 /// Form Load
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmChartOfAccount_Load(object sender, EventArgs e)
 {
     try
     {
         dtblItems.Columns.Add("name");
         dtblItems.Columns.Add("type");
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         DataTable      dtbl           = new DataTable();
         dtbl = spAccountGroup.AccountGroupViewAllByGroupUnder(-1);
         foreach (DataRow dr in dtbl.Rows)
         {
             tvChartOfAccount.Nodes.Add(dr["accountGroupId"].ToString(), dr["accountGroupName"].ToString());
         }
         foreach (TreeNode tn1 in tvChartOfAccount.Nodes)
         {
             FillTree(tn1);
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "COA3:" + ex.Message;
     }
 }
예제 #33
0
 /// <summary>
 /// Form Load
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmChartOfAccount_Load(object sender, EventArgs e)
 {
     try
     {
         dtblItems.Columns.Add("name");
         dtblItems.Columns.Add("type");
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         DataTable      dtbl           = new DataTable();
         dtbl = spAccountGroup.AccountGroupViewAllByGroupUnder(-1);
         foreach (DataRow dr in dtbl.Rows)
         {
             tvChartOfAccount.Nodes.Add(dr["accountGroupId"].ToString(), dr["accountGroupName"].ToString());
         }
         foreach (TreeNode tn1 in tvChartOfAccount.Nodes)
         {
             FillTree(tn1);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("COA:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #34
0
        /// <summary>
        /// on grid opening balance textbox keypress
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvtxtOpeningBalance_KeyPress(object sender, KeyPressEventArgs e)
        {
            AccountGroupSP spAccountGroup = new AccountGroupSP();

            try
            {
                if (dgvMultipleAccountLedger.CurrentCell != null)
                {
                    if (dgvMultipleAccountLedger.Columns[dgvMultipleAccountLedger.CurrentCell.ColumnIndex].Name == "dgvtxtOpeningBalance")
                    {
                        Common.DecimalValidation(sender, e, false);
                    }

                    if (dgvMultipleAccountLedger.Columns[dgvMultipleAccountLedger.CurrentCell.ColumnIndex].Name == "dgvtxtLedgerName")
                    {
                        if (dgvMultipleAccountLedger.Columns["dgvtxtLedgerName"].Index == 1)
                        {
                            string strNature;
                            strNature = spAccountGroup.MultipleAccountLedgerCrOrDr(cmbAccountGroup.Text);
                            if (strNature == "Assets" || strNature == "Income")
                            {
                                dgvMultipleAccountLedger.Rows[dgvMultipleAccountLedger.CurrentRow.Index].Cells["dgvcmbDebitOrCredit"].Value = "Cr";
                            }
                            else if (strNature == "Expenses" || strNature == "Liabilities")
                            {
                                dgvMultipleAccountLedger.Rows[dgvMultipleAccountLedger.CurrentRow.Index].Cells["dgvcmbDebitOrCredit"].Value = "Dr";
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("MAL17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #35
0
 /// <summary>
 /// On print button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvCashOrBank.Rows.Count > 0)
         {
             AccountGroupSP spAccountGroup = new AccountGroupSP();
             DataSet dsCashBankBook = spAccountGroup.CashBankBookPrinting(1, this.dtpFromDate.Value, this.dtpToDate.Value, true);
             frmReport frmReport = new frmReport();
             frmReport.MdiParent = formMDI.MDIObj;
             frmReport.CashBankBookPrinting(dsCashBankBook);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CBBOOK09 :" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #36
0
        /// <summary>
        /// Fills to control on cell double click in Datagridview
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvAccountGroup_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    AccountGroupInfo InfoAccountGroup = new AccountGroupInfo();
                    AccountGroupSP spAccountGroup = new AccountGroupSP();
                    InfoAccountGroup = spAccountGroup.AccountGroupViewForUpdate(Convert.ToDecimal(dgvAccountGroup.CurrentRow.Cells["dgvtxtAccountGroupId"].Value.ToString()));
                    bool Isdefault=InfoAccountGroup.IsDefault;
                    txtAccountGroupName.Text = InfoAccountGroup.AccountGroupName;
                    cmbGroupUnder.SelectedValue = InfoAccountGroup.GroupUnder.ToString();
                    decimal decAccountGroupId =Convert.ToDecimal(cmbGroupUnder.SelectedValue.ToString());
                    string strNature = spAccountGroup.AccountGroupNatureUnderGroup(decAccountGroupId);
                    if (strNature != "NA")
                    {
                        cmbNature.Text = InfoAccountGroup.Nature;
                        cmbNature.Enabled = false;
                    }
                    else
                    {
                        cmbNature.Text = InfoAccountGroup.Nature;
                        cmbNature.Enabled = true;
                    }
                    if (Isdefault)
                    {
                        decimal decAffectGrossProfit = Convert.ToDecimal(InfoAccountGroup.AffectGrossProfit);
                        if (decAffectGrossProfit == 0)
                        {
                            cmbAffectGrossProfit.Text = "No";

                        }
                        else
                        {
                            cmbAffectGrossProfit.Text = "Yes";
                        }
                    }
                    else
                    {
                        cmbAffectGrossProfit.Text = InfoAccountGroup.AffectGrossProfit;
                    }
                    txtNarration.Text = InfoAccountGroup.Narration;
                    btnSave.Text = "Update";
                    txtAccountGroupName.Focus();
                    btnDelete.Enabled = true;
                    strAccountGroupName = InfoAccountGroup.AccountGroupName;
                    decAccountGroupIdForEdit = Convert.ToDecimal(dgvAccountGroup.CurrentRow.Cells["dgvtxtAccountGroupId"].Value.ToString());
                    inId = Convert.ToInt32(InfoAccountGroup.AccountGroupId.ToString());
                    isDefault = Convert.ToBoolean(InfoAccountGroup.IsDefault);

                    if (isDefault == true  && strNature!="NA")
                    {
                        txtAccountGroupName.Enabled = false;
                        cmbAffectGrossProfit.Enabled = false;
                        cmbGroupUnder.Enabled = false;
                        cmbNature.Enabled = false;
                    }
                    else
                    {
                        if (strNature == "NA")
                        {
                            txtAccountGroupName.Enabled = true;
                            cmbAffectGrossProfit.Enabled = true;
                            cmbGroupUnder.Enabled = true;
                            cmbNature.Enabled = true;
                        }
                        
                     }
                    if (isDefault == false)
                    {
                        if (spAccountGroup.AccountGroupCheckExistenceOfUnderGroup(Convert.ToDecimal(inId.ToString())) == false)
                        {
                            cmbAffectGrossProfit.Enabled = false;
                            cmbGroupUnder.Enabled = false;
                            cmbNature.Enabled = false;
                        }
                        else
                        {
                            if (strNature == "NA")
                            {
                                cmbAffectGrossProfit.Enabled = true;
                                cmbGroupUnder.Enabled = true;
                                cmbNature.Enabled = true;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("AG18:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #37
0
 /// <summary>
 /// Function to delete account group
 /// </summary>
 public void Delete()
 {
     try
     {
         if (isDefault == true)
         {
             Messages.InformationMessage("Can't delete build in account group");
         }
         //else if (PublicVariables.isMessageDelete)
         //{
         else if (Messages.DeleteConfirmation())
         {
             AccountGroupInfo InfoAccountGroup = new AccountGroupInfo();
             AccountGroupSP spAccountGroup = new AccountGroupSP();
             if ((spAccountGroup.AccountGroupReferenceDelete(decAccountGroupIdForEdit) == -1))
             {
                 Messages.ReferenceExistsMessage();
             }
             else
             {
                 Messages.DeletedMessage();
                 btnSave.Text = "Save";
                 btnDelete.Enabled = false;
                 Clear();
             }
         }
         //}
         //else
         //{
         //    AccountGroupInfo InfoAccountGroup = new AccountGroupInfo();
         //    AccountGroupSP spAccountGroup = new AccountGroupSP();
         //    if ((spAccountGroup.AccountGroupReferenceDelete(decAccountGroupIdForEdit) == -1))
         //    {
         //        Messages.ReferenceExistsMessage();
         //    }
         //    else
         //    {
         //        Messages.DeletedMessage();
         //        btnSave.Text = "Save";
         //        btnDelete.Enabled = false;
         //        Clear();
         //    }
         //}
     }
     catch (Exception ex)
     {
         MessageBox.Show("AG10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #38
0
 /// <summary>
 /// Function to save and edit account group
 /// </summary>
 public void SaveOrEdit()
 {
     try
     {
         strAccountGroupName = btnSave.Text == "Save" ? string.Empty : strAccountGroupName;
         if (CheckExistanceOfGroupName() == false)
         {
             if (txtAccountGroupName.Text.Trim() == string.Empty)
             {
                 Messages.InformationMessage("Enter account group name");
                 txtAccountGroupName.Focus();
             }
             else if (cmbGroupUnder.SelectedIndex == -1)
             {
                 Messages.InformationMessage("Select under");
                 cmbGroupUnder.Focus();
             }
             else if (cmbNature.SelectedIndex == -1)
             {
                 Messages.InformationMessage("Select nature");
                 cmbNature.Focus();
             }
             else
             {
                 AccountGroupInfo infoAccountGroup = new AccountGroupInfo();
                 AccountGroupSP spAccountGroup = new AccountGroupSP();
                 infoAccountGroup.AccountGroupName = txtAccountGroupName.Text.Trim();
                 infoAccountGroup.GroupUnder = Convert.ToDecimal(cmbGroupUnder.SelectedValue.ToString());
                 infoAccountGroup.Nature = cmbNature.SelectedItem.ToString();
                 if (cmbAffectGrossProfit.SelectedIndex == -1)
                 {
                     infoAccountGroup.AffectGrossProfit = "No";
                 }
                 else
                 {
                     infoAccountGroup.AffectGrossProfit = cmbAffectGrossProfit.SelectedItem.ToString();
                 }
                 infoAccountGroup.IsDefault = false;
                 infoAccountGroup.Narration = txtNarration.Text.Trim();
                 infoAccountGroup.Extra1 = string.Empty;
                 infoAccountGroup.Extra2 = string.Empty;
                 if (btnSave.Text == "Save")
                 {
                     if (Messages.SaveConfirmation())
                     {
                         decAccountGroupId = spAccountGroup.AccountGroupAddWithIdentity(infoAccountGroup);
                         Messages.SavedMessage();
                         decIdForOtherForms = decAccountGroupId;
                         if (frmAccountLedgerobj != null)
                         {
                             this.Close();
                         }
                         GridFill();
                         Clear();
                     }
                 }
                 else
                 {
                     if (isDefault == true)
                     {
                         Messages.InformationMessage("Can't update build in account group");
                     }
                     else if (txtAccountGroupName.Text.Trim().ToLower() != cmbGroupUnder.Text.ToLower())
                     {
                         if (Messages.UpdateConfirmation())
                         {
                             infoAccountGroup.AccountGroupId = decAccountGroupIdForEdit;
                             if (spAccountGroup.AccountGroupUpdate(infoAccountGroup))
                             {
                                 Messages.UpdatedMessage();
                             }
                             GridFill();
                             Clear();
                         }
                     }
                     else
                     {
                         Messages.InformationMessage(" Can't save under same group");
                     }
                 }
             }
         }
         else
         {
             Messages.InformationMessage(" Account group already exist");
             txtAccountGroupName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AG8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #39
0
 /// <summary>
 /// Form Load
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmChartOfAccount_Load(object sender, EventArgs e)
 {
     try
     {
         dtblItems.Columns.Add("name");
         dtblItems.Columns.Add("type");
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         DataTable dtbl = new DataTable();
         dtbl = spAccountGroup.AccountGroupViewAllByGroupUnder(-1);
         foreach (DataRow dr in dtbl.Rows)
         {
             tvChartOfAccount.Nodes.Add(dr["accountGroupId"].ToString(), dr["accountGroupName"].ToString());
         }
         foreach (TreeNode tn1 in tvChartOfAccount.Nodes)
         {
             FillTree(tn1);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("COA:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill the report in grid for fundflow
 /// </summary>
 /// <param name="decCS"></param>
 public void GridFillForFundFlow(decimal decCS)
 {
     decimal decBalanceTotal = 0;
     try
     {
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         DataTable dtbl = new DataTable();
         dtbl = spAccountGroup.AccountGroupWiseReportViewAll(decAccountGroupId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text));
         DataRow drow = dtbl.NewRow();
         decimal decCsop = 0;
         drow[1] = -2;
         drow[2] = 0;
         drow[3] = "Closing Stock";
         drow[4] = decCsop .ToString ()+ ".00Dr";
         drow[5] = decCS;
         drow[6] = "0.00";      
         drow[7] = decCS.ToString ()+"Dr";
         drow[8] = decCS.ToString();
         dtbl.Rows.InsertAt(drow,dtbl .Rows .Count );
         dgvAccountGroupWiseReport.DataSource = dtbl;
         if (dtbl.Rows.Count > 0)
         {
             for (int i = 0; i < dgvAccountGroupWiseReport.RowCount; i++)
             {
                 decBalanceTotal += Convert.ToDecimal(dgvAccountGroupWiseReport.Rows[i].Cells["balance1"].Value.ToString());
             }
         }
         if (decBalanceTotal < 0)
         {
             decBalanceTotal = -1 * decBalanceTotal;
             lblBalanceTotal.Text = decBalanceTotal.ToString() + "Cr";
         }
         else
         {
             lblBalanceTotal.Text = decBalanceTotal.ToString() + "Dr";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AGWREP03:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #41
0
 /// <summary>
 /// Function to fill account group combo for Search
 /// </summary>
 public void GroupUnderSearchComboFill()
 {
     try
     {
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         DataTable dtblEmployeeCode = new DataTable();
         dtblEmployeeCode = spAccountGroup.AccountGroupViewAllComboFill();
         DataRow dr = dtblEmployeeCode.NewRow();
         dr[1] = "All";
         dtblEmployeeCode.Rows.InsertAt(dr, 0);
         cmbGroupUnderSearch.DataSource = dtblEmployeeCode;
         cmbGroupUnderSearch.ValueMember = "accountGroupId";
         cmbGroupUnderSearch.DisplayMember = "accountGroupName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("AG3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #42
0
 /// <summary>
 /// function to fill particulars combo
 /// </summary>
 public void GroupNameViewForComboFill()
 {
     try
     {
         DataTable dtbl = new DataTable();
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         dtbl = spAccountGroup.GroupNameViewForComboFill();
         dgvcmbParticular.DataSource = dtbl;
         dgvcmbParticular.ValueMember = "accountGroupId";
         dgvcmbParticular.DisplayMember = "accountGroupName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("BU3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #43
0
        /// <summary>
        /// Function to fill the report in grid
        /// </summary>
        public void AccountGroupGridFill()
        {
            decimal        decBalanceTotal = 0;
            DateTime       dtmFromDate     = DateTime.Now;
            DateTime       dtmToDate       = DateTime.Now;
            AccountGroupSP spAccountGroup  = new AccountGroupSP();
            DataTable      dtbl            = new DataTable();

            try
            {
                if (txtFromDate.Text != string.Empty)
                {
                    dtmFromDate = Convert.ToDateTime(txtFromDate.Text);
                }
                if (txtToDate.Text != string.Empty)
                {
                    dtmToDate = Convert.ToDateTime(txtToDate.Text);
                }
                dtbl = spAccountGroup.AccountGroupReportFill(dtmFromDate, dtmToDate);
                for (int i = 0; i < dtbl.Rows.Count; i++)
                {
                    if (Convert.ToDecimal(dtbl.Rows[i]["accountGroupId"].ToString()) == 6)
                    {
                        FinancialStatementSP spFinace = new FinancialStatementSP();
                        CalculationMethod();
                        decimal dcOpeninggStock = spFinace.StockValueGetOnDate(PublicVariables._dtFromDate, calculationMethod, true, true);
                        dcOpeninggStock = Math.Round(dcOpeninggStock, PublicVariables._inNoOfDecimalPlaces);
                        decimal decOpBalance = Convert.ToDecimal(dtbl.Rows[i]["OpBalance"].ToString()) + dcOpeninggStock;
                        decimal decClosing   = Convert.ToDecimal(dtbl.Rows[i]["balance1"].ToString()) + dcOpeninggStock;
                        if (decOpBalance >= 0)
                        {
                            dtbl.Rows[i]["OpeningBalance"] = decOpBalance.ToString() + "Dr";
                        }
                        else
                        {
                            dtbl.Rows[i]["OpeningBalance"] = decOpBalance.ToString() + "Cr";
                        }
                        if (decClosing >= 0)
                        {
                            dtbl.Rows[i]["balance"] = decClosing.ToString() + "Dr";
                        }
                        else
                        {
                            dtbl.Rows[i]["balance"] = decClosing.ToString() + "Cr";
                        }
                        dtbl.Rows[i]["balance1"] = decClosing.ToString();
                    }
                }
                dgvAccountGroupReport.DataSource = dtbl;
                if (dgvAccountGroupReport.RowCount > 0)
                {
                    for (int i = 0; i < dgvAccountGroupReport.RowCount; i++)
                    {
                        decBalanceTotal = decBalanceTotal + Convert.ToDecimal(dgvAccountGroupReport.Rows[i].Cells["dgvtxtBalance1"].Value.ToString());
                    }
                }
                if (decBalanceTotal < 0)
                {
                    decBalanceTotal      = -1 * decBalanceTotal;
                    lblBalanceTotal.Text = decBalanceTotal.ToString() + "Cr";
                }
                else
                {
                    lblBalanceTotal.Text = decBalanceTotal.ToString() + "Dr";;
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "AGR4:" + ex.Message;
            }
        }
예제 #44
0
 /// <summary>
 /// datagridview cell beginend edit
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvBudget_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     try
     {
         inUpdatingRowIndexForPartyRemove = -1;
         decUpdatingLedgerForPartyremove = 0;
         DataTable dtbl = new DataTable();
         AccountLedgerSP SpAccountLedger = new AccountLedgerSP();
         if (cmbType.SelectedIndex == 0)
         {
             if (dgvBudget.CurrentCell.ColumnIndex == dgvBudget.Columns["dgvcmbParticular"].Index)
             {
                 dtbl = SpAccountLedger.AccountLedgerViewAll();
                 DataRow dr = dtbl.NewRow();
                 dr[0] = 0;
                 dr[2] = string.Empty;
                 dtbl.Rows.InsertAt(dr, 0);
                 if (dtbl.Rows.Count > 0)
                 {
                     if (dgvBudget.RowCount > 1)
                     {
                         int inGridRowCount = dgvBudget.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 (dgvBudget.Rows[inI].Cells["dgvcmbParticular"].Value != null && dgvBudget.Rows[inI].Cells["dgvcmbParticular"].Value.ToString() != string.Empty)
                                     {
                                         if (dtbl.Rows[inJ]["ledgerId"].ToString() == dgvBudget.Rows[inI].Cells["dgvcmbParticular"].Value.ToString())
                                         {
                                             dtbl.Rows.RemoveAt(inJ);
                                             break;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     DataGridViewComboBoxCell dgvccVoucherType = (DataGridViewComboBoxCell)dgvBudget[dgvBudget.Columns["dgvcmbParticular"].Index, e.RowIndex];
                     dgvccVoucherType.DataSource = dtbl;
                     dgvccVoucherType.ValueMember = "ledgerId";
                     dgvccVoucherType.DisplayMember = "ledgerName";
                 }
             }
             if (dgvBudget.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvcmbParticular")
             {
                 if (dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].Value != null && dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].Value.ToString() != string.Empty)
                 {
                     AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                     if (spAccountLedger.AccountGroupIdCheck(dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].FormattedValue.ToString()))
                     {
                         inUpdatingRowIndexForPartyRemove = e.RowIndex;
                         decUpdatingLedgerForPartyremove = Convert.ToDecimal(dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].Value.ToString());
                     }
                 }
             }
             if (dgvBudget.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvcmbDrOrCr")
             {
                 if (dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].Value != null && dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].Value.ToString() != string.Empty)
                 {
                     AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                     if (spAccountLedger.AccountGroupIdCheck(dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].FormattedValue.ToString()))
                     {
                         inUpdatingRowIndexForPartyRemove = e.RowIndex;
                         decUpdatingLedgerForPartyremove = Convert.ToDecimal(dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].Value.ToString());
                     }
                 }
             }
         }
         else
         {
             if (dgvBudget.CurrentCell.ColumnIndex == dgvBudget.Columns["dgvcmbParticular"].Index)
             {
                 AccountGroupSP spAccountGroup = new AccountGroupSP();
                 dtbl = spAccountGroup.GroupNameViewForComboFill();
                 DataRow dr = dtbl.NewRow();
                 dr[0] = 0;
                 dtbl.Rows.InsertAt(dr, 0);
                 if (dtbl.Rows.Count > 0)
                 {
                     if (dgvBudget.RowCount > 1)
                     {
                         int inGridRowCount = dgvBudget.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 (dgvBudget.Rows[inI].Cells["dgvcmbParticular"].Value != null && dgvBudget.Rows[inI].Cells["dgvcmbParticular"].Value.ToString() != string.Empty)
                                     {
                                         if (dtbl.Rows[inJ]["accountGroupName"].ToString() == dgvBudget.Rows[inI].Cells["dgvcmbParticular"].Value.ToString())
                                         {
                                             dtbl.Rows.RemoveAt(inJ);
                                             break;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     DataGridViewComboBoxCell dgvccVoucherType = (DataGridViewComboBoxCell)dgvBudget[dgvBudget.Columns["dgvcmbParticular"].Index, e.RowIndex];
                     dgvccVoucherType.DataSource = dtbl;
                     dgvccVoucherType.ValueMember = "accountGroupId";
                     dgvccVoucherType.DisplayMember = "accountGroupName";
                 }
             }
             if (dgvBudget.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvcmbParticular")
             {
                 if (dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].Value != null && dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].Value.ToString() != string.Empty)
                 {
                     AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                     if (spAccountLedger.AccountGroupIdCheck(dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].FormattedValue.ToString()))
                     {
                         inUpdatingRowIndexForPartyRemove = e.RowIndex;
                         decUpdatingLedgerForPartyremove = Convert.ToDecimal(dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].Value.ToString());
                     }
                 }
             }
             if (dgvBudget.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "dgvcmbDrOrCr")
             {
                 if (dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].Value != null && dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].Value.ToString() != string.Empty)
                 {
                     AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                     if (spAccountLedger.AccountGroupIdCheck(dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].FormattedValue.ToString()))
                     {
                         inUpdatingRowIndexForPartyRemove = e.RowIndex;
                         decUpdatingLedgerForPartyremove = Convert.ToDecimal(dgvBudget.Rows[e.RowIndex].Cells["dgvcmbParticular"].Value.ToString());
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("BU37:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #45
0
 /// <summary>
 /// Function to check wheteher cash or bank is selected
 /// </summary>
 public void CheckWhetherBankOrCash()
 {
     try
     {
         //----- To make readonly txtChequeNo and txtChequeDate if selected ledger group is cash-----//
         if (cmbCashOrBank.SelectedValue != null && cmbCashOrBank.SelectedValue.ToString() != string.Empty)
         {
             decimal decLedger = Convert.ToDecimal(cmbCashOrBank.SelectedValue.ToString());
             bool isBankAcocunt = false;
             AccountGroupSP SpGroup = new AccountGroupSP();
             DataTable dtbl = new DataTable();
             dtbl = SpGroup.CheckWheatherLedgerUnderCash();
             //-------- Checking whether the selected legder is under bank----------//
             foreach (DataRow dr in dtbl.Rows)
             {
                 string str = dr.ItemArray[0].ToString();
                 if (decLedger == Convert.ToDecimal(dr.ItemArray[0].ToString()))
                 {
                     isBankAcocunt = true;
                 }
             }
             if (isBankAcocunt)
             {
                 txtCheckNo.Enabled = false;
                 txtChequeDate.Enabled = false;
                 dtpCheckDate.Enabled = false;
                 txtCheckNo.Clear();
             }
             else
             {
                 txtCheckNo.Enabled = true;
                 txtChequeDate.Enabled = true;
                 dtpCheckDate.Enabled = true;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AP17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #46
0
        /// <summary>
        /// Fills to control on cell double click in Datagridview
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvAccountGroup_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    AccountGroupInfo InfoAccountGroup = new AccountGroupInfo();
                    AccountGroupSP   spAccountGroup   = new AccountGroupSP();
                    InfoAccountGroup = spAccountGroup.AccountGroupViewForUpdate(Convert.ToDecimal(dgvAccountGroup.CurrentRow.Cells["dgvtxtAccountGroupId"].Value.ToString()));
                    bool Isdefault = InfoAccountGroup.IsDefault;
                    txtAccountGroupName.Text    = InfoAccountGroup.AccountGroupName;
                    cmbGroupUnder.SelectedValue = InfoAccountGroup.GroupUnder.ToString();
                    decimal decAccountGroupId = Convert.ToDecimal(cmbGroupUnder.SelectedValue.ToString());
                    string  strNature         = spAccountGroup.AccountGroupNatureUnderGroup(decAccountGroupId);
                    if (strNature != "NA")
                    {
                        cmbNature.Text    = InfoAccountGroup.Nature;
                        cmbNature.Enabled = false;
                    }
                    else
                    {
                        cmbNature.Text    = InfoAccountGroup.Nature;
                        cmbNature.Enabled = true;
                    }
                    if (Isdefault)
                    {
                        decimal decAffectGrossProfit = Convert.ToDecimal(InfoAccountGroup.AffectGrossProfit);
                        if (decAffectGrossProfit == 0)
                        {
                            cmbAffectGrossProfit.Text = "No";
                        }
                        else
                        {
                            cmbAffectGrossProfit.Text = "Yes";
                        }
                    }
                    else
                    {
                        cmbAffectGrossProfit.Text = InfoAccountGroup.AffectGrossProfit;
                    }
                    txtNarration.Text = InfoAccountGroup.Narration;
                    btnSave.Text      = "Update";
                    txtAccountGroupName.Focus();
                    btnDelete.Enabled        = true;
                    strAccountGroupName      = InfoAccountGroup.AccountGroupName;
                    decAccountGroupIdForEdit = Convert.ToDecimal(dgvAccountGroup.CurrentRow.Cells["dgvtxtAccountGroupId"].Value.ToString());
                    inId      = Convert.ToInt32(InfoAccountGroup.AccountGroupId.ToString());
                    isDefault = Convert.ToBoolean(InfoAccountGroup.IsDefault);

                    if (isDefault == true && strNature != "NA")
                    {
                        txtAccountGroupName.Enabled  = false;
                        cmbAffectGrossProfit.Enabled = false;
                        cmbGroupUnder.Enabled        = false;
                        cmbNature.Enabled            = false;
                    }
                    else
                    {
                        if (strNature == "NA")
                        {
                            txtAccountGroupName.Enabled  = true;
                            cmbAffectGrossProfit.Enabled = true;
                            cmbGroupUnder.Enabled        = true;
                            cmbNature.Enabled            = true;
                        }
                    }
                    if (isDefault == false)
                    {
                        if (spAccountGroup.AccountGroupCheckExistenceOfUnderGroup(Convert.ToDecimal(inId.ToString())) == false)
                        {
                            cmbAffectGrossProfit.Enabled = false;
                            cmbGroupUnder.Enabled        = false;
                            cmbNature.Enabled            = false;
                        }
                        else
                        {
                            if (strNature == "NA")
                            {
                                cmbAffectGrossProfit.Enabled = true;
                                cmbGroupUnder.Enabled        = true;
                                cmbNature.Enabled            = true;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("AG18:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #47
0
 /// <summary>
 /// Fill function for updation
 /// </summary>
 public void FillFunction()
 {
     try
     {
         isValueChange = false;
         ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo();
         ReceiptMasterSP SpReceiptMaster = new ReceiptMasterSP();
         ReceiptDetailsInfo InfoReceiptDetails = new ReceiptDetailsInfo();
         ReceiptDetailsSP SpReceiptDetails = new ReceiptDetailsSP();
         PartyBalanceSP SpPartyBalance = new PartyBalanceSP();
         LedgerPostingSP SpLedgerPosting = new LedgerPostingSP();
         VoucherTypeSP SpVoucherType = new VoucherTypeSP();
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         AccountLedgerSP SpAccountLedger = new AccountLedgerSP();
         InfoReceiptMaster = SpReceiptMaster.ReceiptMasterViewByMasterId(decRecieptmasterId);
         isAutomatic = SpVoucherType.CheckMethodOfVoucherNumbering(InfoReceiptMaster.VoucherTypeId);
         if (isAutomatic)
         {
             txtVoucherNo.ReadOnly = true;
             txtVoucherNo.Text = InfoReceiptMaster.InvoiceNo;
         }
         else
         {
             txtVoucherNo.ReadOnly = false;
             txtVoucherNo.Text = InfoReceiptMaster.VoucherNo;
         }
         dtpDate.Value = InfoReceiptMaster.Date;
         cmbCashOrBank.SelectedValue = InfoReceiptMaster.LedgerId;
         txtNarration.Text = InfoReceiptMaster.Narration;
         txtTotal.Text = InfoReceiptMaster.TotalAmount.ToString();
         decDailySuffixPrefixId = InfoReceiptMaster.SuffixPrefixId;
         decReceiptVoucherTypeId = InfoReceiptMaster.VoucherTypeId;
         strVoucherNo = InfoReceiptMaster.VoucherNo;
         strInvoiceNo = InfoReceiptMaster.InvoiceNo;
         DataTable dtbl = new DataTable();
         dtbl = SpReceiptDetails.ReceiptDetailsViewByMasterId(decRecieptmasterId);
         for (int inI = 0; inI < dtbl.Rows.Count; inI++)
         {
             dgvReceiptVoucher.Rows.Add();
             dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString());
             dgvReceiptVoucher.Rows[inI].Cells["dgvtxtreceiptMasterId"].Value = dtbl.Rows[inI]["receiptMasterId"].ToString();
             dgvReceiptVoucher.Rows[inI].Cells["dgvtxtreceiptDetailsId"].Value = dtbl.Rows[inI]["receiptDetailsId"].ToString();
             dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = dtbl.Rows[inI]["amount"].ToString();
             dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(dtbl.Rows[inI]["exchangeRateId"].ToString());
             decimal decDetailsId1 = Convert.ToDecimal(dtbl.Rows[inI]["receiptDetailsId"].ToString());
             decimal decLedgerPostingId = SpLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, decReceiptVoucherTypeId);
             dgvReceiptVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString();
             decimal decLedgerId = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString());
             bool IsBankAccount = spAccountGroup.AccountGroupwithLedgerId(decLedgerId);
             decimal decI = Convert.ToDecimal(SpAccountLedger.AccountGroupIdCheck(dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].FormattedValue.ToString()));
             if (decI > 0)
             {
                 dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].ReadOnly = true;
                 dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].ReadOnly = true;
             }
             else
             {
                 dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].ReadOnly = false;
                 dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].ReadOnly = false;
             }
             if (dtbl.Rows[inI]["chequeNo"].ToString() != string.Empty)
             {
                 dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value = dtbl.Rows[inI]["chequeNo"].ToString();
                 dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value = Convert.ToDateTime(dtbl.Rows[inI]["chequeDate"].ToString()).ToString("dd-MMM-yyyy");
             }
             dgvReceiptVoucher.Rows[inI].HeaderCell.Value = string.Empty;
         }
         DataTable dtbl1 = new DataTable();
         dtbl1 = SpPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decReceiptVoucherTypeId, strVoucherNo, InfoReceiptMaster.Date);
         dtblPartyBalance = dtbl1;
         isValueChange = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("RV34:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #48
0
        private void cmbGroupUnder_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (cmbGroupUnder.SelectedValue != null && cmbGroupUnder.SelectedValue.ToString() != "System.Data.DataRowView")
                {
                    decimal decAccountGroupId = Convert.ToDecimal(cmbGroupUnder.SelectedValue.ToString());
                    AccountGroupSP spAccountGroup = new AccountGroupSP();
                    AccountGroupInfo infoAccountGroup = new AccountGroupInfo();
                    infoAccountGroup = spAccountGroup.AccountGroupView(decAccountGroupId);
                    string strNature = infoAccountGroup.Nature;
                    string strIsAffectGrossProfit = infoAccountGroup.AffectGrossProfit;
                   // string strNature = spAccountGroup.AccountGroupNatureUnderGroup(decAccountGroupId);
                    if (strNature != "NA")
                    {
                        cmbNature.Text = strNature;
                        if (infoAccountGroup.AffectGrossProfit == "1")
                        {
                            cmbAffectGrossProfit.SelectedIndex = 0;
                        }
                        else
                        {
                            cmbAffectGrossProfit.SelectedIndex = 1;
                        }
                        cmbNature.Enabled = false;
                        cmbAffectGrossProfit.Enabled = false;
                       
                    }
                    else
                    {
                        cmbNature.Enabled = true;
                        cmbAffectGrossProfit.Enabled = true;
                    }
                }
            }
            catch (Exception)
            {

                
            }
            //if (txtAccountGroupName.Text != null && txtAccountGroupName.Text != string.Empty)
            //{
               
             
            //}
            //else
            //{
            //    cmbNature.Enabled = true;
            //}
        }
예제 #49
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);
            }
        }
예제 #50
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);
            }
        }
예제 #51
0
 /// <summary>
 /// Function to save and edit account group
 /// </summary>
 public void SaveOrEdit()
 {
     try
     {
         strAccountGroupName = btnSave.Text == "Save" ? string.Empty : strAccountGroupName;
         if (CheckExistanceOfGroupName() == false)
         {
             if (txtAccountGroupName.Text.Trim() == string.Empty)
             {
                 Messages.InformationMessage("Enter account group name");
                 txtAccountGroupName.Focus();
             }
             else if (cmbGroupUnder.SelectedIndex == -1)
             {
                 Messages.InformationMessage("Select under");
                 cmbGroupUnder.Focus();
             }
             else if (cmbNature.SelectedIndex == -1)
             {
                 Messages.InformationMessage("Select nature");
                 cmbNature.Focus();
             }
             else
             {
                 AccountGroupInfo infoAccountGroup = new AccountGroupInfo();
                 AccountGroupSP   spAccountGroup   = new AccountGroupSP();
                 infoAccountGroup.AccountGroupName = txtAccountGroupName.Text.Trim();
                 infoAccountGroup.GroupUnder       = Convert.ToDecimal(cmbGroupUnder.SelectedValue.ToString());
                 infoAccountGroup.Nature           = cmbNature.SelectedItem.ToString();
                 if (cmbAffectGrossProfit.SelectedIndex == -1)
                 {
                     infoAccountGroup.AffectGrossProfit = "No";
                 }
                 else
                 {
                     infoAccountGroup.AffectGrossProfit = cmbAffectGrossProfit.SelectedItem.ToString();
                 }
                 infoAccountGroup.IsDefault = false;
                 infoAccountGroup.Narration = txtNarration.Text.Trim();
                 infoAccountGroup.Extra1    = string.Empty;
                 infoAccountGroup.Extra2    = string.Empty;
                 if (btnSave.Text == "Save")
                 {
                     if (Messages.SaveConfirmation())
                     {
                         decAccountGroupId = spAccountGroup.AccountGroupAddWithIdentity(infoAccountGroup);
                         Messages.SavedMessage();
                         decIdForOtherForms = decAccountGroupId;
                         if (frmAccountLedgerobj != null)
                         {
                             this.Close();
                         }
                         GridFill();
                         Clear();
                     }
                 }
                 else
                 {
                     if (isDefault == true)
                     {
                         Messages.InformationMessage("Can't update build in account group");
                     }
                     else if (txtAccountGroupName.Text.Trim().ToLower() != cmbGroupUnder.Text.ToLower())
                     {
                         if (Messages.UpdateConfirmation())
                         {
                             infoAccountGroup.AccountGroupId = decAccountGroupIdForEdit;
                             if (spAccountGroup.AccountGroupUpdate(infoAccountGroup))
                             {
                                 Messages.UpdatedMessage();
                             }
                             GridFill();
                             Clear();
                         }
                     }
                     else
                     {
                         Messages.InformationMessage(" Can't save under same group");
                     }
                 }
             }
         }
         else
         {
             Messages.InformationMessage(" Account group already exist");
             txtAccountGroupName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AG8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #52
0
 /// <summary>
 /// Function to fill the report in grid
 /// </summary>
 public void AccountGroupGridFill()
 {
     decimal decBalanceTotal = 0;
     DateTime dtmFromDate = DateTime.Now;
     DateTime dtmToDate = DateTime.Now;
     AccountGroupSP spAccountGroup = new AccountGroupSP();
     DataTable dtbl = new DataTable();
     try
     {
         if (txtFromDate.Text != string.Empty)
         {
             dtmFromDate = Convert.ToDateTime(txtFromDate.Text);
         }
         if (txtToDate.Text != string.Empty)
         {
             dtmToDate = Convert.ToDateTime(txtToDate.Text);
         }
         dtbl = spAccountGroup.AccountGroupReportFill(dtmFromDate, dtmToDate);
         for (int i = 0; i < dtbl.Rows.Count; i++)
         {
             if(Convert.ToDecimal(dtbl.Rows[i]["accountGroupId"].ToString())==6)
             {
                 FinancialStatementSP spFinace = new FinancialStatementSP();
                 CalculationMethod();
                 decimal dcOpeninggStock = spFinace.StockValueGetOnDate(PublicVariables._dtFromDate, calculationMethod, true, true);
                 dcOpeninggStock = Math.Round(dcOpeninggStock, PublicVariables._inNoOfDecimalPlaces);
                 decimal decOpBalance=Convert.ToDecimal(dtbl.Rows[i]["OpBalance"].ToString())+dcOpeninggStock;
                 decimal decClosing=Convert.ToDecimal(dtbl.Rows[i]["balance1"].ToString())+dcOpeninggStock;
                 if (decOpBalance >= 0)
                 {
                     dtbl.Rows[i]["OpeningBalance"] = decOpBalance.ToString() + "Dr";
                 }
                 else
                 {
                    dtbl.Rows[i]["OpeningBalance"] = decOpBalance.ToString() + "Cr";
                 }
                 if (decClosing >= 0)
                 {
                     dtbl.Rows[i]["balance"] = decClosing.ToString() + "Dr";
                 }
                 else
                 {
                     dtbl.Rows[i]["balance"] = decClosing.ToString() + "Cr";
                 }
                 dtbl.Rows[i]["balance1"] = decClosing.ToString();
             }
         }
         dgvAccountGroupReport.DataSource = dtbl;
         if (dgvAccountGroupReport.RowCount > 0)
         {
             for (int i = 0; i < dgvAccountGroupReport.RowCount; i++)
             {
                 decBalanceTotal = decBalanceTotal + Convert.ToDecimal(dgvAccountGroupReport.Rows[i].Cells["dgvtxtBalance1"].Value.ToString());
             }
         }
         if (decBalanceTotal < 0)
         {
             decBalanceTotal = -1 * decBalanceTotal;
             lblBalanceTotal.Text = decBalanceTotal.ToString() + "Cr";
         }
         else
         {
             lblBalanceTotal.Text = decBalanceTotal.ToString() + "Dr"; ;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AGR:4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to call from CashFlow for current asset grid fill
 /// </summary>
 public void CashOutflowCurrentAssetGridFill()
 {
     decimal decBalanceTotal = 0;
     try
     {
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         DataTable dtbl = new DataTable();
         dtbl = spAccountGroup.CashOutflowCurrentAssetAccountGroupWiseReportViewAll(decAccountGroupId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text));
         dgvAccountGroupWiseReport.DataSource = dtbl;
         if (dtbl.Rows.Count > 0)
         {
             for (int i = 0; i < dgvAccountGroupWiseReport.RowCount; i++)
             {
                 decBalanceTotal += Convert.ToDecimal(dgvAccountGroupWiseReport.Rows[i].Cells["balance1"].Value.ToString());
             }
         }
         if (decBalanceTotal < 0)
         {
             decBalanceTotal = -1 * decBalanceTotal;
             lblBalanceTotal.Text = decBalanceTotal.ToString() + "Cr";
         }
         else
         {
             lblBalanceTotal.Text = decBalanceTotal.ToString() + "Dr";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AGWREP11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #54
0
 /// <summary>
 /// Call the totalamount,SlNo,InvalidEntry functions to do the all are the process even if change one value of the grid
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvContraVoucher_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         if (e.RowIndex != -1 && e.ColumnIndex != -1)
         {
             if (dgvContraVoucher.Rows[e.RowIndex].Cells["dgvcmbBankorCashAccount"].Value != null && dgvContraVoucher.Rows[e.RowIndex].Cells["dgvcmbBankorCashAccount"].Value.ToString() != "")
             {
                 if (dgvContraVoucher.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value == null || dgvContraVoucher.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value.ToString() == "")
                 {
                     dgvContraVoucher.Rows[e.RowIndex].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(1);//PublicVariables._decCurrencyId;
                 }
             }
             TotalAmount();
             SlNo();
             if (dgvContraVoucher.Rows[e.RowIndex].Cells["dgvcmbBankorCashAccount"].Value != null)
             {
                 decimal decLedger = Convert.ToDecimal(dgvContraVoucher.Rows[e.RowIndex].Cells["dgvcmbBankorCashAccount"].Value.ToString());
                 isBankAcocunt = spAccountGroup.AccountGroupwithLedgerId(decLedger);
                 if (isBankAcocunt)
                 {
                     dgvContraVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].ReadOnly = false;
                     dgvContraVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeNo"].ReadOnly = false;
                 }
                 else
                 {
                     dgvContraVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].ReadOnly = true;
                     dgvContraVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeNo"].ReadOnly = true;
                     dgvContraVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].Value = string.Empty;
                     dgvContraVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeNo"].Value = string.Empty;
                 }
             }
             CheckColumnMissing(e);
             if (!dgvContraVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].ReadOnly)
             {
                 DateValidation objVal = new DateValidation();
                 TextBox txtDate = new TextBox();
                 if (dgvContraVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].Value != null)
                 {
                     txtDate.Text = dgvContraVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].Value.ToString();
                     bool isDate = objVal.DateValidationFunction(txtDate);
                     if (isDate)
                     {
                         dgvContraVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].Value = txtDate.Text;
                     }
                     else
                     {
                         dgvContraVoucher.Rows[e.RowIndex].Cells["dgvtxtChequeDate"].Value = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy");
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CV:42" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #55
0
 /// <summary>
 /// Function to check existance of account group in DataBase
 /// </summary>
 /// <returns></returns>
 public bool CheckExistanceOfGroupName()
 {
     bool isExist = false;
     try
     {
         //Check whether a group name already exist in DB
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         isExist = spAccountGroup.AccountGroupCheckExistence(txtAccountGroupName.Text.Trim(), 0);
         if (isExist)
         {
             if (txtAccountGroupName.Text.ToLower() == strAccountGroupName.ToLower())
             {
                 isExist = false;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AG5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return isExist;
 }
예제 #56
0
        /// <summary>
        /// on grid opening balance textbox keypress
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvtxtOpeningBalance_KeyPress(object sender, KeyPressEventArgs e)
        {
            AccountGroupSP spAccountGroup = new AccountGroupSP();
            try
            {
                if (dgvMultipleAccountLedger.CurrentCell != null)
                {
                    if (dgvMultipleAccountLedger.Columns[dgvMultipleAccountLedger.CurrentCell.ColumnIndex].Name == "dgvtxtOpeningBalance")
                    {
                        Common.DecimalValidation(sender, e, false);
                    }

                    if (dgvMultipleAccountLedger.Columns[dgvMultipleAccountLedger.CurrentCell.ColumnIndex].Name == "dgvtxtLedgerName")
                    {
                        if (dgvMultipleAccountLedger.Columns["dgvtxtLedgerName"].Index == 1)
                        {
                            string strNature;
                            strNature = spAccountGroup.MultipleAccountLedgerCrOrDr(cmbAccountGroup.Text);
                            if (strNature == "Assets" || strNature == "Income")
                            {
                                dgvMultipleAccountLedger.Rows[dgvMultipleAccountLedger.CurrentRow.Index].Cells["dgvcmbDebitOrCredit"].Value = "Cr";
                            }
                            else if (strNature == "Expenses" || strNature == "Liabilities")
                            {
                                dgvMultipleAccountLedger.Rows[dgvMultipleAccountLedger.CurrentRow.Index].Cells["dgvcmbDebitOrCredit"].Value = "Dr";
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("MAL17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #57
0
 /// <summary>
 /// on combobox account group text changing
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmbAccountGroup_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (isLoad)
         {
             int index = cmbAccountGroup.SelectedIndex;
             string strinr = cmbAccountGroup.Text.ToString();
             int dec = cmbAccountGroup.SelectedIndex;
             int inRowcount = dgvMultipleAccountLedger.RowCount;
             AccountGroupSP spAccountGroup = new AccountGroupSP();
             string strNature;
             strNature = spAccountGroup.MultipleAccountLedgerCrOrDr(cmbAccountGroup.Text);
             for (int i = 0; i < inRowcount; i++)
             {
                 if (strNature == "Assets" || strNature == "Income")
                 {
                     dgvMultipleAccountLedger.Rows[i].Cells["dgvcmbDebitOrCredit"].Value = "Cr";
                 }
                 else if (strNature == "Expenses" || strNature == "Liabilities")
                 {
                     dgvMultipleAccountLedger.Rows[i].Cells["dgvcmbDebitOrCredit"].Value = "Dr";
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MAL12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }