Пример #1
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);
     }
 }
Пример #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)
            {
                formMDI.infoError.ErrorString = "AGR1:" + ex.Message;
            }
        }
Пример #3
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);
     }
 }
Пример #4
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;
            }
        }