コード例 #1
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();
             AccountGroupBll  bllAccountGroup  = new AccountGroupBll();
             if ((bllAccountGroup.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);
     }
 }
コード例 #2
0
        /// <summary>
        /// Function to print report
        /// </summary>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        public void Print(DateTime fromDate, DateTime toDate)
        {
            try
            {
                FinancialStatementBll bllFinancialStatement = new FinancialStatementBll();
                AccountGroupBll       bllAccountGroup       = new AccountGroupBll();
                DataSet          dsAccountGroup             = new DataSet();
                List <DataTable> ListObj = bllAccountGroup.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);

                List <DataTable> listCompany = bllFinancialStatement.FundFlowReportPrintCompany(1);
                dsAccountGroup.Tables.Add(ListObj[0]);
                dsAccountGroup.Tables.Add(listCompany[0]);
                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;
             AccountGroupBll bllAccountGroup = new AccountGroupBll();
             string          strNature;
             strNature = bllAccountGroup.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);
     }
 }
コード例 #4
0
        /// <summary>
        /// Function to call from CashFlow for current asset grid fill
        /// </summary>
        public void CashOutflowCurrentAssetGridFill()
        {
            decimal decBalanceTotal = 0;

            try
            {
                AccountGroupBll  bllAccountGroup = new AccountGroupBll();
                List <DataTable> ListObj         = new List <DataTable>();
                ListObj = bllAccountGroup.CashOutflowCurrentAssetAccountGroupWiseReportViewAll(decAccountGroupId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text));
                dgvAccountGroupWiseReport.DataSource = ListObj;
                if (ListObj[0].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);
            }
        }
コード例 #5
0
        /// <summary>
        /// Function to fill the report in grid
        /// </summary>
        public void GridFill()
        {
            decimal decBalanceTotal = 0;

            try
            {
                AccountGroupBll  bllAccountGroup = new AccountGroupBll();
                List <DataTable> ListObj         = new List <DataTable>();
                ListObj = bllAccountGroup.AccountGroupWiseReportViewAll(decAccountGroupId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text));
                if (decAccountGroupId == 6)
                {
                    FinancialStatementBll bllFinancialStatement = new FinancialStatementBll();
                    CalculationMethod();
                    decimal dcOpeninggStock = bllFinancialStatement.StockValueGetOnDate(PublicVariables._dtFromDate, calculationMethod, true, true);
                    dcOpeninggStock = Math.Round(dcOpeninggStock, PublicVariables._inNoOfDecimalPlaces);
                    int     inRowCount = ListObj[0].Rows.Count;
                    DataRow dr         = ListObj[0].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;
                    ListObj[0].Rows.InsertAt(dr, inRowCount);
                }
                dgvAccountGroupWiseReport.DataSource = ListObj[0];
                if (ListObj[0].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);
            }
        }
コード例 #6
0
 /// <summary>
 /// Function to fill accountgroup combobox
 /// </summary>
 /// <param name="cmbAccountGroup"></param>
 public void AccountGroupComboFill(ComboBox cmbAccountGroup)
 {
     try
     {
         cmbAccountGroup.Enabled = true;
         AccountGroupBll bllAccountGroup = new AccountGroupBll();
         bllAccountGroup.BillAllocationAccountGroupFill(cmbAccountGroup, true);
     }
     catch (Exception ex)
     {
         MessageBox.Show("BA:02" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #7
0
 /// <summary>
 /// Function to fill ledgers as TreeMode
 /// </summary>
 /// <param name="tn"></param>
 public void FillTree(TreeNode tn)
 {
     try
     {
         List <DataTable> ListObj         = new List <DataTable>();
         AccountGroupBll  bllAccountGroup = new AccountGroupBll();
         ListObj = bllAccountGroup.AccountGroupViewAllByGroupUnder(Convert.ToDecimal(tn.Name));
         AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
         if (ListObj[0].Rows.Count > 0)
         {
             foreach (DataRow dr in ListObj[0].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);
                 List <DataTable> ListObjLedger = bllAccountLedger.AccountLedgerViewAllByLedgerName(Convert.ToDecimal(tn1.Name));
                 foreach (DataRow dr in ListObjLedger[0].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);
     }
 }
コード例 #8
0
 /// <summary>
 /// Function to fill account group combo
 /// </summary>
 public void GroupUnderComboFill()
 {
     try
     {
         AccountGroupBll  bllAccountGroup = new AccountGroupBll();
         List <DataTable> ListObj         = new List <DataTable>();
         ListObj = bllAccountGroup.AccountGroupViewAllComboFill();
         cmbGroupUnder.DataSource    = ListObj[0];
         cmbGroupUnder.ValueMember   = "accountGroupId";
         cmbGroupUnder.DisplayMember = "accountGroupName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("AG2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #9
0
 /// <summary>
 /// Function to fill master grid
 /// </summary>
 public void GridFill()
 {
     try
     {
         List <DataTable> ListObj         = new List <DataTable>();
         AccountGroupBll  bllAccountGroup = new AccountGroupBll();
         if (cmbGroupUnderSearch.Text.Trim() == string.Empty)
         {
             cmbGroupUnderSearch.Text = "All";
         }
         ListObj = bllAccountGroup.AccountGroupSearch(txtAccountGroupNameSearch.Text.Trim(), cmbGroupUnderSearch.Text);
         dgvAccountGroup.DataSource = ListObj[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("AG1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #10
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
            {
                AccountGroupBll  bllAccountGroup = new AccountGroupBll();
                List <DataTable> ListObj         = new List <DataTable>();
                ListObj = bllAccountGroup.AccountGroupWiseReportViewAll(decAccountGroupId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text));
                DataRow drow    = ListObj[0].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();
                ListObj[0].Rows.InsertAt(drow, ListObj[0].Rows.Count);
                dgvAccountGroupWiseReport.DataSource = ListObj[0];
                if (ListObj[0].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);
            }
        }
コード例 #11
0
 /// <summary>
 /// Function to fill account group combo for Search
 /// </summary>
 public void GroupUnderSearchComboFill()
 {
     try
     {
         AccountGroupBll  bllAccountGroup = new AccountGroupBll();
         List <DataTable> ListObj         = new List <DataTable>();
         ListObj = bllAccountGroup.AccountGroupViewAllComboFill();
         DataRow dr = ListObj[0].NewRow();
         dr[1] = "All";
         ListObj[0].Rows.InsertAt(dr, 0);
         cmbGroupUnderSearch.DataSource    = ListObj[0];
         cmbGroupUnderSearch.ValueMember   = "accountGroupId";
         cmbGroupUnderSearch.DisplayMember = "accountGroupName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("AG3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #12
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)
         {
             AccountGroupBll bllAccountGroup = new AccountGroupBll();
             DataSet         dsCashBankBook  = bllAccountGroup.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);
     }
 }
コード例 #13
0
        /// <summary>
        /// Function to check existance of account group in DataBase
        /// </summary>
        /// <returns></returns>
        public bool CheckExistanceOfGroupName()
        {
            bool isExist = false;

            try
            {
                AccountGroupBll bllAccountGroup = new AccountGroupBll();
                isExist = bllAccountGroup.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);
        }
コード例 #14
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");
         AccountGroupBll  bllAccountGroup = new AccountGroupBll();
         List <DataTable> ListObj         = new List <DataTable>();
         ListObj = bllAccountGroup.AccountGroupViewAllByGroupUnder(-1);
         foreach (DataRow dr in ListObj[0].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);
     }
 }
コード例 #15
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());
             AccountGroupBll  bllAccountGroup   = new AccountGroupBll();
             AccountGroupInfo infoAccountGroup  = new AccountGroupInfo();
             infoAccountGroup = bllAccountGroup.AccountGroupView(decAccountGroupId);
             string strNature = infoAccountGroup.Nature;
             string strIsAffectGrossProfit = infoAccountGroup.AffectGrossProfit;
             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)
     {
     }
 }
コード例 #16
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)
        {
            AccountGroupBll bllAccountGroup = new AccountGroupBll();

            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 = bllAccountGroup.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);
            }
        }
コード例 #17
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();
                    AccountGroupBll  bllAccountGroup  = new AccountGroupBll();
                    InfoAccountGroup = bllAccountGroup.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         = bllAccountGroup.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 (bllAccountGroup.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);
            }
        }
コード例 #18
0
        /// <summary>
        /// Function to fill the report in grid
        /// </summary>
        public void AccountGroupGridFill()
        {
            decimal          decBalanceTotal = 0;
            DateTime         dtmFromDate     = DateTime.Now;
            DateTime         dtmToDate       = DateTime.Now;
            AccountGroupBll  bllAccountGroup = new AccountGroupBll();
            List <DataTable> ListObj         = new List <DataTable>();

            try
            {
                if (txtFromDate.Text != string.Empty)
                {
                    dtmFromDate = Convert.ToDateTime(txtFromDate.Text);
                }
                if (txtToDate.Text != string.Empty)
                {
                    dtmToDate = Convert.ToDateTime(txtToDate.Text);
                }
                ListObj = bllAccountGroup.AccountGroupReportFill(dtmFromDate, dtmToDate);
                for (int i = 0; i < ListObj[0].Rows.Count; i++)
                {
                    if (Convert.ToDecimal(ListObj[0].Rows[i]["accountGroupId"].ToString()) == 6)
                    {
                        FinancialStatementBll bllFinancialStatement = new FinancialStatementBll();
                        CalculationMethod();
                        decimal dcOpeninggStock = bllFinancialStatement.StockValueGetOnDate(PublicVariables._dtFromDate, calculationMethod, true, true);
                        dcOpeninggStock = Math.Round(dcOpeninggStock, PublicVariables._inNoOfDecimalPlaces);
                        decimal decOpBalance = Convert.ToDecimal(ListObj[0].Rows[i]["OpBalance"].ToString()) + dcOpeninggStock;
                        decimal decClosing   = Convert.ToDecimal(ListObj[0].Rows[i]["balance1"].ToString()) + dcOpeninggStock;
                        if (decOpBalance >= 0)
                        {
                            ListObj[0].Rows[i]["OpeningBalance"] = decOpBalance.ToString() + "Dr";
                        }
                        else
                        {
                            ListObj[0].Rows[i]["OpeningBalance"] = decOpBalance.ToString() + "Cr";
                        }
                        if (decClosing >= 0)
                        {
                            ListObj[0].Rows[i]["balance"] = decClosing.ToString() + "Dr";
                        }
                        else
                        {
                            ListObj[0].Rows[i]["balance"] = decClosing.ToString() + "Cr";
                        }
                        ListObj[0].Rows[i]["balance1"] = decClosing.ToString();
                    }
                }
                dgvAccountGroupReport.DataSource = ListObj[0];
                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);
            }
        }
コード例 #19
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();
                 AccountGroupBll  bllAccountGroup  = new AccountGroupBll();
                 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 = bllAccountGroup.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 (bllAccountGroup.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);
     }
 }