예제 #1
0
        public ValidComb VHasClosing(ValidComb validComb, IClosingService _closingService)
        {
            Closing closing = _closingService.GetObjectById(validComb.ClosingId);

            if (closing == null)
            {
                validComb.Errors.Add("Closing", "Tidak valid");
            }
            return(validComb);
        }
예제 #2
0
        public dynamic Close(Closing model)
        {
            try
            {
                if (!AuthenticationModel.IsAllowed("Confirm", Core.Constants.Constant.MenuName.Closing, Core.Constants.Constant.MenuGroupName.Report))
                {
                    Dictionary <string, string> Errors = new Dictionary <string, string>();
                    Errors.Add("Generic", "You are Not Allowed to Confirm Record");

                    return(Json(new
                    {
                        Errors
                    }, JsonRequestBehavior.AllowGet));
                }

                var data = _closingService.GetObjectById(model.Id);
                data.ClosedAt = model.ClosedAt;
                model         = _closingService.CloseObject(data, _accountService, _generalLedgerJournalService, _validCombService);
            }
            catch (Exception ex)
            {
                LOG.Error("Confirm Failed", ex);
                Dictionary <string, string> Errors = new Dictionary <string, string>();
                Errors.Add("Generic", "Error " + ex);

                return(Json(new
                {
                    Errors
                }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new
            {
                model.Errors
            }));
        }
예제 #3
0
        public ActionResult ReportBalanceSheet(Nullable <int> closingId)
        {
            var     company = _companyService.GetQueryable().FirstOrDefault();
            Closing closing = _closingService.GetObjectById(closingId.GetValueOrDefault());

            if (closing == null)
            {
                return(Content(Constant.ErrorPage.ClosingNotFound));
            }

            var balanceValidComb = _validCombService.GetQueryable().Include("Account").Include("Closing")
                                   .Where(x => x.ClosingId == closing.Id & x.Account.Level == 2);

            List <ModelBalanceSheet> query = new List <ModelBalanceSheet>();

            query = (from obj in balanceValidComb
                     select new ModelBalanceSheet()
            {
                CompanyName = company.Name,
                StartDate = closing.BeginningPeriod,
                EndDate = closing.EndDatePeriod,
                DCNote = (obj.Account.Group == Constant.AccountGroup.Asset ||
                          obj.Account.Group == Constant.AccountGroup.Expense) ? "D" : "C",
                AccountName = obj.Account.Code.Substring(0, 1),
                AccountGroup = (obj.Account.Group == Constant.AccountGroup.Asset) ? "Asset" :
                               (obj.Account.Group == Constant.AccountGroup.Expense) ? "Expense" :
                               (obj.Account.Group == Constant.AccountGroup.Liability) ? "Liability" :
                               (obj.Account.Group == Constant.AccountGroup.Equity) ? "Equity" :
                               (obj.Account.Group == Constant.AccountGroup.Revenue) ? "Revenue" : "",
                AccountTitle = obj.Account.Name,
                CurrentAmount = obj.Amount,
                PrevAmount = obj.Amount,
                ASSET = "nonASSET",         // untuk Fix Asset ? "ASSET" : "nonASSET",
                AccountCode = obj.Account.Code
            }).OrderBy(x => x.AccountCode).ToList();

            var rd = new ReportDocument();

            //Loading Report
            rd.Load(Server.MapPath("~/") + "Reports/Finance/BalanceSheet.rpt");

            // Setting report data source
            rd.SetDataSource(query);

            var stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            return(File(stream, "application/pdf"));
        }