/// <summary>
        /// Gets the cash report S11 h.
        /// </summary>
        /// <param name="reportParameter">The report parameter.</param>
        /// <param name="oRsTool">The o rs tool.</param>
        /// <returns>IList&lt;CashReportModel&gt;.</returns>
        public IList <S12HModel> ReportS12H(ReportParameter reportParameter, ReportSharpHelper oRsTool)
        {
            IList <S12HModel> reports = null;

            GlobalVariable.IsDisplayNewLicenseInfo = false;
            var amountType   = GlobalVariable.AmountTypeViewReport;
            var currencyCode = GlobalVariable.CurrencyViewReport;
            //var isTotalBandInNewPage = false;

            var fromDate = DateTime.Now;
            var toDate   = DateTime.Now;

            if (!oRsTool.IsRefresh)
            {
                using (var frmParam = new FrmS12H())
                {
                    frmParam.Text = @"S12-H: Sổ tiền gửi ngân hàng, kho bạc";
                    if (frmParam.ShowDialog() == DialogResult.OK)
                    {
                        var startDate = DateTime.Parse(frmParam.StartDate);
                        fromDate = DateTime.Parse(frmParam.FromDate);
                        toDate   = DateTime.Parse(frmParam.ToDate);

                        //isTotalBandInNewPage = frmParam.IsTotalBandInNewPage;
                        //var accountNumber = frmParam.AccountCode;
                        //if (!oRsTool.Parameters.ContainsKey("Account"))
                        //    oRsTool.Parameters.Add("Account",
                        //        "Tài khoản: " + accountNumber + " - " + frmParam.AccountName);
                        //if (!oRsTool.Parameters.ContainsKey("AccountNumber"))
                        //    oRsTool.Parameters.Add("AccountNumber", accountNumber);
                        if (!oRsTool.Parameters.ContainsKey("IsDetail"))
                        {
                            oRsTool.Parameters.Add("IsDetail", frmParam.IsDetail);
                        }

                        reports = Model.ReportS12H(startDate, fromDate, toDate, frmParam.BudgetChapterCode, frmParam.BudgetSubKindItemCode,
                                                   frmParam.AccountNumber, frmParam.BankId, frmParam.IsSummaryBankId,
                                                   frmParam.IsSummaryBudgetChapter, frmParam.IsSummaryBudgetSubKindItem, frmParam.IsDetail, amountType, currencyCode);
                    }
                }
            }
            //else
            //{
            //    var accountNumber = oRsTool.Parameters["AccountNumber"].ToString();
            //    list = Model.GetCashS12HWithStoreProdure(commonVariable.ReportList.ProcedureName, GlobalVariable.FromDate.ToShortDateString(),
            //                GlobalVariable.ToDate.ToShortDateString(), amountType, accountNumber, currencyCode, false, null);
            //}

            if (reports != null && reports.Count > 0)
            {
                //if (!oRsTool.Parameters.ContainsKey("CurrencyCodeUnit"))

                //    oRsTool.Parameters.Add("CurrencyCodeUnit",
                //        "Đơn vị tính " + (amountType == 2 ? "(nguyên tệ): " : "(quy đổi): ") + currencyCode);

                //if (!oRsTool.Parameters.ContainsKey("Year"))
                //    oRsTool.Parameters.Add("Year", "Năm:" + GlobalVariable.ToDate.Year);

                if (!oRsTool.Parameters.ContainsKey("FromDate"))
                {
                    oRsTool.Parameters.Add("FromDate", fromDate.ToShortDateString());
                }

                if (!oRsTool.Parameters.ContainsKey("ToDate"))
                {
                    oRsTool.Parameters.Add("ToDate", toDate.ToShortDateString());
                }

                //if (!oRsTool.Parameters.ContainsKey("Province"))
                //    oRsTool.Parameters.Add("Province", _globalVariable.CompanyProvince);

                //if (!oRsTool.Parameters.ContainsKey("ReportDate"))
                //    oRsTool.Parameters.Add("ReportDate", _globalVariable.PostedDate);

                //// ThoDD add trạng thái chuyển sang trang sau
                //if (!oRsTool.Parameters.ContainsKey("IsTotalBandInNewPage"))
                //    oRsTool.Parameters.Add("IsTotalBandInNewPage", isTotalBandInNewPage);

                ////làm Footer  để có cấu trúc sang trang
                //if (!oRsTool.Parameters.ContainsKey("footClosing"))
                //    oRsTool.Parameters.Add("footClosing", list[list.Count - 1].RestAmount);
                //list.RemoveAt(list.Count - 1);
                //if (!oRsTool.Parameters.ContainsKey("footReceipt"))
                //    oRsTool.Parameters.Add("footReceipt", list[list.Count - 1].ReceiptAmount);
                //if (!oRsTool.Parameters.ContainsKey("footPay"))
                //    oRsTool.Parameters.Add("footPay", list[list.Count - 1].PayAmount);
                //if (!oRsTool.Parameters.ContainsKey("footExist"))
                //    oRsTool.Parameters.Add("footExist", list[list.Count - 1].RestAmount);

                //list.RemoveAt(list.Count - 1);
                //list.RemoveAt(list.Count - 1);
            }
            return(reports);
        }
Example #2
0
        /// <summary>
        /// Gets the cash report S12 h.
        /// </summary>
        /// <param name="frmParent">The FRM parent.</param>
        /// <param name="commonVariable">The common variable.</param>
        /// <param name="oRsTool">The o rs tool.</param>
        /// <returns></returns>
        public IList <CashReportModel> GetCashReportS12H(XtraForm frmParent, GlobalVariable commonVariable, ReportSharpHelper oRsTool)
        {
            IList <CashReportModel> list = null;
            var  amountType   = GlobalVariable.AmountTypeViewReport;
            var  currencyCode = GlobalVariable.CurrencyViewReport;
            bool isBank       = false;
            int? bankId       = null;

            var isTotalBandInNewPage = false;

            if (!oRsTool.IsRefresh)
            {
                using (var frmParam = new FrmS12H())
                {
                    frmParam.Text = @"Sổ chi tiền gửi ngân hàng";
                    if (frmParam.ShowDialog() == DialogResult.OK)
                    {
                        GlobalVariable.FromDate = DateTime.Parse(frmParam.FromDate);
                        GlobalVariable.ToDate   = DateTime.Parse(frmParam.ToDate);
                        isTotalBandInNewPage    = frmParam.IsTotalBandInNewPage;
                        var accountNumber = frmParam.AccountCode;
                        isBank = frmParam.IsBank;
                        bankId = frmParam.BankId;


                        if (!oRsTool.Parameters.ContainsKey("Account"))
                        {
                            oRsTool.Parameters.Add("Account", "Tài khoản: " + accountNumber + " - " + frmParam.AccountName);
                        }

                        if (!oRsTool.Parameters.ContainsKey("AccountNumber"))
                        {
                            oRsTool.Parameters.Add("AccountNumber", accountNumber);
                        }

                        if (!oRsTool.Parameters.ContainsKey("BankName"))
                        {
                            oRsTool.Parameters.Add("BankName", frmParam.BankName);
                        }

                        list = Model.GetCashS12HWithStoreProdure(commonVariable.ReportList.ProcedureName, GlobalVariable.FromDate.ToShortDateString(),
                                                                 GlobalVariable.ToDate.ToShortDateString(), amountType, accountNumber, currencyCode, isBank, bankId);
                    }
                }
            }
            else
            {
                var accountNumber = oRsTool.Parameters["AccountNumber"].ToString();
                list = Model.GetCashS12HWithStoreProdure(commonVariable.ReportList.ProcedureName, GlobalVariable.FromDate.ToShortDateString(),
                                                         GlobalVariable.ToDate.ToShortDateString(), amountType, accountNumber, currencyCode, false, null);
            }
            if (list != null && list.Count > 0)
            {
                if (!oRsTool.Parameters.ContainsKey("CurrencyCodeUnit"))
                {
                    oRsTool.Parameters.Add("CurrencyCodeUnit",
                                           "Đơn vị tính " + (amountType == 2 ? "(nguyên tệ): " : "(quy đổi): ") + currencyCode);
                }

                if (!oRsTool.Parameters.ContainsKey("FromDate"))
                {
                    oRsTool.Parameters.Add("FromDate", GlobalVariable.FromDate.ToShortDateString());
                }

                if (!oRsTool.Parameters.ContainsKey("ToDate"))
                {
                    oRsTool.Parameters.Add("ToDate", GlobalVariable.ToDate.ToShortDateString());
                }

                if (!oRsTool.Parameters.ContainsKey("Year"))
                {
                    oRsTool.Parameters.Add("Year", "Năm:" + GlobalVariable.ToDate.Year);
                }

                if (!oRsTool.Parameters.ContainsKey("Province"))
                {
                    oRsTool.Parameters.Add("Province", _globalVariable.CompanyProvince);
                }

                if (!oRsTool.Parameters.ContainsKey("ReportDate"))
                {
                    oRsTool.Parameters.Add("ReportDate", _globalVariable.PostedDate);
                }

                // ThoDD add trạng thái chuyển sang trang sau
                if (!oRsTool.Parameters.ContainsKey("IsTotalBandInNewPage"))
                {
                    oRsTool.Parameters.Add("IsTotalBandInNewPage", isTotalBandInNewPage);
                }

                //làm Footer  để có cấu trúc sang trang
                if (!oRsTool.Parameters.ContainsKey("footClosing"))
                {
                    oRsTool.Parameters.Add("footClosing", list[list.Count - 1].RestAmount);
                }
                list.RemoveAt(list.Count - 1);
                if (!oRsTool.Parameters.ContainsKey("footReceipt"))
                {
                    oRsTool.Parameters.Add("footReceipt", list[list.Count - 1].ReceiptAmount);
                }
                if (!oRsTool.Parameters.ContainsKey("footPay"))
                {
                    oRsTool.Parameters.Add("footPay", list[list.Count - 1].PayAmount);
                }
                if (!oRsTool.Parameters.ContainsKey("footExist"))
                {
                    oRsTool.Parameters.Add("footExist", list[list.Count - 1].RestAmount);
                }

                list.RemoveAt(list.Count - 1);
                list.RemoveAt(list.Count - 1);
            }
            return(list);
        }