Exemple #1
0
        public ActionResult Index(EnumReports rpt, ReportsViewModel rptVM)
        {
            ReportDataSource[]        repCol   = new ReportDataSource[1];
            ReportParameterCollection paramCol = null;

            switch (rpt)
            {
            case EnumReports.RptWODailyRecap:
                repCol[0] = GetWOs(rptVM.RptDateFrom, rptVM.RptDateTo);

                //set params
                paramCol = new ReportParameterCollection();
                paramCol.Add(new ReportParameter("V_START_DATE", rptVM.RptDateFrom.Value.ToString()));
                paramCol.Add(new ReportParameter("V_END_DATE", rptVM.RptDateTo.Value.ToString()));
                break;
            }

            //send report data source and report params to session data
            Session["ReportData"]   = repCol;
            Session["ReportParams"] = paramCol;

            var e = new
            {
                Success   = true,
                Message   = "redirect",
                UrlReport = string.Format("{0}", rpt.ToString())
            };

            return(Json(e, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public ActionResult Report(EnumReports reports, EnumDepartment?dep, ReportParamViewModel viewModel, FormCollection formCollection)
        {
            ReportDataSource[] repCol   = new ReportDataSource[1];
            DateTime?          dateFrom = Helper.CommonHelper.ConvertToDate(formCollection["DateFrom"]);
            DateTime?          dateTo   = Helper.CommonHelper.ConvertToDate(formCollection["DateTo"]);

            switch (reports)
            {
            case EnumReports.RptDueInstallment:
                repCol[0] = GetDueInstallment(dateFrom, dateTo);
                break;

            case EnumReports.RptCommission:
                repCol[0] = GetCommission(viewModel.RecPeriodId, dep);
                break;

            case EnumReports.RptPartnerHutang:
                repCol[0] = GetLoan(viewModel.DateFrom, viewModel.DateTo, viewModel.PartnerId);
                break;

            case EnumReports.RptChartLoan:
                repCol[0] = GetLoan(viewModel.DateFrom, viewModel.DateTo, viewModel.PartnerId);
                break;
            }
            HttpContext.Session["ReportData"] = repCol;

            var e = new
            {
                Success   = true,
                Message   = "redirect",
                UrlReport = string.Format("{0}", reports.ToString())
            };

            return(Json(e, JsonRequestBehavior.AllowGet));
        }
        private void RestoreSelectedItemStat()
        {
            var temp = invisibleSelectedItemStat;

            invisibleSelectedItemStat = ReportSelectedItemStat;

            if (temp != EnumReports.None)
            {
                reportSelectedItemStat = temp;
            }
        }
 private void SetDefaultItemStat(bool isTournament)
 {
     if (isTournament)
     {
         reportSelectedItemStat    = EnumReports.TournamentResults;
         invisibleSelectedItemStat = EnumReports.OverAll;
     }
     else
     {
         reportSelectedItemStat    = EnumReports.OverAll;
         invisibleSelectedItemStat = EnumReports.TournamentResults;
     }
 }
Exemple #5
0
        public ActionResult Index(EnumReports rpt)
        {
            string title = string.Empty;

            switch (rpt)
            {
            case EnumReports.RptWODailyRecap:
                title = "Laporan Harian Servis Printer";
                break;
            }
            ViewBag.Title = title;

            ReportsViewModel rptVM = new ReportsViewModel();

            return(View(rptVM));
        }
Exemple #6
0
        public ActionResult Index(EnumReports rpt, ReportsViewModel rptVM)
        {
            ReportDataSource[]        repCol   = new ReportDataSource[1];
            ReportParameterCollection paramCol = null;

            switch (rpt)
            {
            case EnumReports.RptMasterCustomer:
                repCol[0] = GetCustomers();
                break;

            case EnumReports.RptMasterEmp:
                repCol[0] = GetEmps();
                break;

            case EnumReports.RptMasterEquip:
                repCol[0] = GetEquips();
                break;

            case EnumReports.RptPrintInvoice_Pph:
                repCol    = new ReportDataSource[2];
                repCol[0] = GetInvoice(rptVM.ProjectId, rptVM.RptPeriod, ref rpt);
                repCol[1] = GetBap(rptVM.ProjectId, rptVM.RptPeriod);
                break;

            case EnumReports.RptAbsentDetail:
                repCol    = new ReportDataSource[1];
                repCol[0] = GetAbsentAll(rptVM.ProjectId, rptVM.RptPeriod);
                //repCol[0] = GetAbsent(rptVM.ProjectId, rptVM.RptPeriod);
                //repCol[1] = GetAbsentDetail(rptVM.ProjectId, rptVM.RptPeriod);
                break;
            }

            //send report data source and report params to session data
            Session["ReportData"]   = repCol;
            Session["ReportParams"] = paramCol;

            var e = new
            {
                Success   = true,
                Message   = "redirect",
                UrlReport = string.Format("{0}", rpt.ToString())
            };

            return(Json(e, JsonRequestBehavior.AllowGet));
        }
        private ActionResult SaveJournalInterface(TJournal journal, FormCollection formCollection)
        {
            if (formCollection["btnSave"] != null)
            {
                if (journal.JournalType == EnumJournalType.GeneralLedger.ToString() && !ValidateDebetKredit())
                {
                    var e = new
                    {
                        Success = false,
                        Message = "Total Debet dan Kredit tidak sama."
                    };
                    return(Json(e, JsonRequestBehavior.AllowGet));
                }
                return(SaveJournal(journal, formCollection));
            }
            else if (formCollection["btnPrint"] != null || formCollection["btnPrintKwitansi"] != null)
            {
                //save data to session
                SetDataForPrint(journal.Id, journal.JournalType);
                string reportUrl = string.Empty;
                if (formCollection["btnPrint"] != null)
                {
                    EnumReports reportToPrint = EnumReports.RptPrintCash;
                    if (journal.JournalType == EnumJournalType.GeneralLedger.ToString())
                    {
                        reportToPrint = EnumReports.RptPrintGL;
                    }

                    reportUrl = Url.Content("~/ReportViewer.aspx?rpt=" + reportToPrint.ToString());
                }
                else if (formCollection["btnPrintKwitansi"] != null)
                {
                    reportUrl = Url.Content("~/ReportViewer.aspx?rpt=RptPrintKwitansi");
                }

                var e = new
                {
                    Success = false,
                    Message = "redirect",
                    Data    = reportUrl
                };
                return(Json(e, JsonRequestBehavior.AllowGet));
            }
            return(View());
        }
Exemple #8
0
        public ActionResult Index(EnumReports rpt)
        {
            string           title = string.Empty;
            ReportsViewModel rptVM = new ReportsViewModel();

            switch (rpt)
            {
            case EnumReports.RptMasterCustomer:
                rptVM.Title        = "Daftar Konsumen";
                rptVM.ShowDateFrom = false;
                rptVM.ShowDateTo   = false;
                break;

            case EnumReports.RptMasterEmp:
                rptVM.Title        = "Daftar Karyawan";
                rptVM.ShowDateFrom = false;
                rptVM.ShowDateTo   = false;
                break;

            case EnumReports.RptMasterEquip:
                rptVM.Title        = "Daftar Peralatan";
                rptVM.ShowDateFrom = false;
                rptVM.ShowDateTo   = false;
                break;

            case EnumReports.RptPrintInvoice_Pph:
                rptVM.Title        = "Cetak Invoice";
                rptVM.ShowDateFrom = false;
                rptVM.ShowDateTo   = false;
                rptVM.ShowPeriod   = true;
                rptVM.ShowProject  = true;
                break;

            case EnumReports.RptAbsentDetail:
                rptVM.Title        = "Laporan Time Sheet";
                rptVM.ShowDateFrom = false;
                rptVM.ShowDateTo   = false;
                rptVM.ShowPeriod   = true;
                rptVM.ShowProject  = true;
                break;
            }
            return(View(rptVM));
        }
Exemple #9
0
        public ActionResult Report(EnumReports reports, EnumDepartment?dep = null)
        {
            ReportParamViewModel viewModel = ReportParamViewModel.Create(_tRecPeriodRepository, _mPartnerRepository);
            string title = string.Empty;

            switch (reports)
            {
            case EnumReports.RptDueInstallment:
                title = "Daftar Angsuran Jatuh Tempo";
                viewModel.ShowDateFrom = true;
                viewModel.ShowDateTo   = false;
                break;

            case EnumReports.RptCommission:
                title = "Lap. Komisi Karyawan";
                viewModel.ShowRecPeriod = true;
                break;

            case EnumReports.RptPartnerHutang:
                title = "Lap. Hutang Toko";
                viewModel.ShowDateFrom = true;
                viewModel.ShowDateTo   = true;
                viewModel.ShowPartner  = true;
                break;

            case EnumReports.RptChartLoan:
                title = "Grafik Pengajuan Kredit";
                viewModel.ShowDateFrom = true;
                viewModel.ShowDateTo   = true;
                viewModel.ShowPartner  = true;
                break;
            }
            ViewData["CurrentItem"] = title;


            ViewData["ExportFormat"] = new SelectList(Enum.GetValues(typeof(EnumExportFormat)));

            return(View(viewModel));
        }
Exemple #10
0
        private ReportDataSource GetInvoice(string ProjectId, DateTime?RptPeriod, ref EnumReports rpt)
        {
            var invoices = this._InvoiceTasks.GetListByProjectAndPeriod(ProjectId, RptPeriod);

            if (invoices.Count() > 0)
            {
                TInvoice         inv              = invoices.ToList()[0];
                var              results          = ConvertToTInvoices(inv);
                ReportDataSource reportDataSource = new ReportDataSource("TInvoiceViewModel", results);

                //set rpt to print
                if (inv.ProjectId.ProjectInvoiceFormat == EnumInvoiceFormat.PPH.ToString())
                {
                    rpt = EnumReports.RptPrintInvoice_Pph;
                }
                else if (inv.ProjectId.ProjectInvoiceFormat == EnumInvoiceFormat.PPH_PPN.ToString())
                {
                    rpt = EnumReports.RptPrintInvoice_Pph_Ppn;
                }
                return(reportDataSource);
            }
            return(null);
        }
Exemple #11
0
        public ActionResult Report(EnumReports reports, ReportParamViewModel viewModel, FormCollection formCollection)
        {
            ReportDataSource[] repCol = new ReportDataSource[1];
            switch (reports)
            {
            case EnumReports.RptBrand:
                repCol[0] = GetBrand();
                break;

            case EnumReports.RptCostCenter:
                repCol[0] = GetCostCenter();
                break;

            case EnumReports.RptJournal:
                repCol[0] = GetJournalDet(viewModel.DateFrom, viewModel.DateTo, viewModel.CostCenterId);
                break;

            case EnumReports.RptNeraca:
                repCol[0] = GetRecAccount(EnumAccountCatType.NERACA, viewModel.CostCenterId, viewModel.RecPeriodId);
                break;

            case EnumReports.RptLR:
                repCol[0] = GetRecAccount(EnumAccountCatType.LR, viewModel.CostCenterId, viewModel.RecPeriodId);
                break;

            case EnumReports.RptStockCard:
                repCol[0] = GetStockCard(viewModel.DateFrom, viewModel.DateTo, viewModel.ItemId, viewModel.WarehouseId);
                break;

            case EnumReports.RptStockItem:
                repCol[0] = GetStockItem(viewModel.ItemId, viewModel.WarehouseId);
                break;

            case EnumReports.RptAnalyzeBudgetDetail:
                repCol[0] = GetTransDetForBudget(viewModel.ItemId, viewModel.WarehouseId);
                break;

            case EnumReports.RptPrintFacturService:
                repCol = new ReportDataSource[3];
                TTrans trans = _tTransRepository.Get(viewModel.TransId);
                repCol[0] = GetTrans(trans);
                repCol[1] = GetTransDet(trans.TransDets);
                repCol[2] = GetTransRoom(viewModel.TransId);
                break;

            case EnumReports.RptServiceOmzet:
                repCol[0] = GetServiceOmzet(viewModel.DateFrom.Value, viewModel.DateTo.Value);
                break;

            case EnumReports.RptCommission:
                repCol[0] = GetCommission(viewModel.DateFrom.Value, viewModel.DateTo.Value);
                break;

            case EnumReports.RptSalesByAction:
                repCol[0] = GetTransDetForTotalAction(viewModel.DateFrom.Value, viewModel.DateTo.Value);
                break;

            case EnumReports.RptBukuBesar:
                repCol[0] = GetJournalDet(viewModel.DateFrom, viewModel.DateTo, viewModel.CostCenterId);
                break;

            case EnumReports.RptCommissionRecap:
                repCol[0] = GetCommission(viewModel.DateFrom.Value, viewModel.DateTo.Value);
                break;

            case EnumReports.RptServiceByCustomer:
                repCol[0] = GetTransDetForCustomer(viewModel.DateFrom, viewModel.DateTo, viewModel.CustomerId);
                break;
            }
            Session["ReportData"] = repCol;

            var e = new
            {
                Success   = true,
                Message   = "redirect",
                UrlReport = string.Format("{0}", reports.ToString())
            };

            return(Json(e, JsonRequestBehavior.AllowGet));
        }
Exemple #12
0
        public ActionResult ReportTrans(EnumReports reports, EnumTransactionStatus TransStatus)
        {
            ReportParamViewModel viewModel = ReportParamViewModel.CreateReportParamViewModel(_mWarehouseRepository, _mSupplierRepository, _mItemRepository);
            string title = string.Empty;

            switch (reports)
            {
            case EnumReports.RptBrand:
                title = "Daftar Master Merek";

                break;

            case EnumReports.RptStockCard:
                title = "Kartu Stok";
                viewModel.ShowDateFrom  = true;
                viewModel.ShowDateTo    = true;
                viewModel.ShowItem      = true;
                viewModel.ShowWarehouse = true;
                break;

            case EnumReports.RptStockItem:
                title = "Lap. Stok Per Gudang";
                viewModel.ShowItem      = true;
                viewModel.ShowWarehouse = true;
                break;

            case EnumReports.RptAnalyzeBudgetDetail:
                title = "Lap. Analisa Budget";
                viewModel.ShowItem      = true;
                viewModel.ShowWarehouse = true;
                break;

            case EnumReports.RptTransDetail:
                title = "Lap. Detail";
                viewModel.ShowDateFrom  = true;
                viewModel.ShowDateTo    = true;
                viewModel.ShowWarehouse = true;
                break;

            case EnumReports.RptTransDetailByTransBy:
                title = "Lap. Rekap Detail Transaksi";
                viewModel.ShowDateFrom = true;
                viewModel.ShowDateTo   = true;
                viewModel.ShowSupplier = true;
                break;

            case EnumReports.RptLRDetailSales:
                title = "Lap. Detail Laba Kotor";
                viewModel.ShowDateFrom = true;
                viewModel.ShowDateTo   = true;
                viewModel.ShowCustomer = true;
                break;

            case EnumReports.RptMostItemSales:
                title = "Lap. Penjualan Terbanyak";
                viewModel.ShowDateFrom  = true;
                viewModel.ShowDateTo    = true;
                viewModel.ShowWarehouse = true;
                break;
            }
            ViewData["CurrentItem"] = title;


            ViewData["ExportFormat"] = new SelectList(Enum.GetValues(typeof(EnumExportFormat)));

            return(View(viewModel));
        }
 public ActionResult Report(EnumReports reports)
 {
     return(ReportTrans(reports, EnumTransactionStatus.None));
 }
Exemple #14
0
        private async Task ReportSet(EnumReports reportType, bool forceRefresh)
        {
            try
            {
                reportGadgetViewModel.IsBusy = true;

                // disable radio button panel to restrict changing the report type during loading
                ReportRadioButtonPanel.IsEnabled = false;

                var layout  = ReportManager.GetReportLayout(reportType);
                var creator = ReportManager.GetReportCreator(reportType);

                if (layout == null || creator == null)
                {
                    return;
                }

                var storageModel = ServiceLocator.Current.GetInstance <SingletonStorageModel>();

                var statistic = creator.IsTournament ?
                                storageModel.GetFilteredTournamentPlayerStatistic() :
                                storageModel.GetFilteredCashPlayerStatistic();

                // stop loading report
                reportCancellationTokenSource?.Cancel();
                reportCancellationTokenSource = new CancellationTokenSource();

                var reportCancellationToken = reportCancellationTokenSource.Token;

                var reportCollection = GetReportCollectionAsync(creator, statistic, forceRefresh, reportCancellationToken);

                if (reportCancellationToken.IsCancellationRequested)
                {
                    return;
                }

                // clear columns in order to avoid  Binding exceptions
                GridViewReport.Columns.Clear();

                reportGadgetViewModel.ReportCollection.Clear();
                reportGadgetViewModel.SelectedReportItems.Clear();

                foreach (var item in await reportCollection)
                {
                    reportGadgetViewModel.ReportCollection.Add(item);
                }

                reportGadgetViewModel.IsBusy     = false;
                GridViewReport.FrozenColumnCount = 0;

                layout.Create(GridViewReport);

                reportGadgetViewModel.ReportSelectedItem = reportGadgetViewModel.ReportCollection.FirstOrDefault();

                reportCache = reportType;
            }
            catch (Exception ex)
            {
                LogProvider.Log.Error(ex);
            }
            finally
            {
                ReportRadioButtonPanel.IsEnabled = true;
            }
        }
 public ActionResult ReportTrans(EnumReports reports, ReportParamViewModel viewModel, FormCollection formCollection, EnumReportGroupBy?groupBy = null)
 {
     return(Report(reports, viewModel, formCollection, groupBy));
 }
Exemple #16
0
        public ActionResult PrintInvoice(string random, string invoiceId)
        {
            string      msg        = string.Empty;
            bool        success    = false;
            bool        allowPrint = true;
            EnumReports rptToPrint = EnumReports.RptPrintInvoice_Pph;

            try
            {
                ////get wo by wo id
                //TWO wo = this._woTasks.One(woId);
                ////check if user have print WO, if not, allow print for role CS
                //if (User.IsInRole("CS"))
                //{
                //    allowPrint = !_woLogTasks.HaveBeenPrint(wo, User.Identity.Name);
                //}

                //if (allowPrint)
                //{
                ReportParameterCollection paramCol = null;
                ReportDataSource[]        repCol   = new ReportDataSource[2];
                //get data source
                var invoice  = this._InvoiceTasks.One(invoiceId);
                var baps     = GetTBaps(invoice.ProjectId.Id, invoice.InvoicePeriod);
                var invoices = ConvertToTInvoices(invoice);
                ReportDataSource reportDataSource = new ReportDataSource("TInvoiceViewModel", invoices);
                repCol[0]        = reportDataSource;
                reportDataSource = new ReportDataSource("TBapViewModel", baps);
                repCol[1]        = reportDataSource;

                //set rpt to print
                if (invoice.ProjectId.ProjectInvoiceFormat == EnumInvoiceFormat.PPH.ToString())
                {
                    rptToPrint = EnumReports.RptPrintInvoice_Pph;
                }
                else if (invoice.ProjectId.ProjectInvoiceFormat == EnumInvoiceFormat.PPH_PPN.ToString())
                {
                    rptToPrint = EnumReports.RptPrintInvoice_Pph_Ppn;
                }

                Session["ReportData"]   = repCol;
                Session["ReportParams"] = paramCol;

                success = true;
                msg     = "Print Invoice success";
                //}
                //else
                //{
                //    success = false;
                //    msg = "Anda sudah pernah mencetak WO";
                //}
            }
            catch (Exception ex)
            {
                success = false;
                msg     = ex.GetBaseException().Message;
            }
            var e = new
            {
                Success   = success,
                Message   = msg,
                UrlReport = string.Format("{0}&rs%3aFormat=HTML4.0", rptToPrint.ToString())
            };

            return(Json(e, JsonRequestBehavior.AllowGet));
        }
Exemple #17
0
        public ActionResult Report(EnumReports reports, ReportParamViewModel viewModel, FormCollection formCollection)
        {
            bool   Success = true;
            string Message = "redirect";

            try
            {
                EnumTransactionStatus stat =
                    (EnumTransactionStatus)Enum.Parse(typeof(EnumTransactionStatus), formCollection["TransStatus"]);
                ReportDataSource[] repCol = new ReportDataSource[1];
                switch (reports)
                {
                case EnumReports.RptBrand:
                    repCol[0] = GetBrand();
                    break;

                case EnumReports.RptStockCard:
                    repCol[0] = GetStockCard(viewModel.DateFrom, viewModel.DateTo, viewModel.ItemId, viewModel.WarehouseId);
                    break;

                case EnumReports.RptStockItem:
                    repCol[0] = GetStockItem(viewModel.ItemId, viewModel.WarehouseId);
                    break;

                case EnumReports.RptAnalyzeBudgetDetail:
                    repCol[0] = GetTransDetForBudget(viewModel.ItemId, viewModel.WarehouseId);
                    break;

                case EnumReports.RptTransDetail:
                    repCol[0] = GetTransTotal(viewModel.DateFrom, viewModel.DateTo, viewModel.WarehouseId, stat);
                    break;

                case EnumReports.RptTransDetailByTransBy:
                    repCol[0] = GetTransTotal(viewModel.DateFrom, viewModel.DateTo, viewModel.WarehouseId, viewModel.SupplierId, stat);
                    break;

                case EnumReports.RptLRDetailSales:
                    repCol[0] = GetTransTotalAndRef(viewModel.DateFrom, viewModel.DateTo, null, viewModel.CustomerId, stat);
                    break;

                case EnumReports.RptMostItemSales:
                    repCol[0] = GetTransDetail(viewModel.DateFrom, viewModel.DateTo, viewModel.WarehouseId, stat);
                    break;
                }
                Session["ReportData"] = repCol;
            }
            catch (Exception ex)
            {
                Success = false;
                Message = "Error :\n " + ex.GetBaseException().Message;
            }


            var e = new
            {
                Success,
                Message,
                UrlReport = string.Format("{0}", reports.ToString())
            };

            return(Json(e, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Report(EnumReports reports, ReportParamViewModel viewModel, FormCollection formCollection)
        {
            ReportDataSource[] repCol = new ReportDataSource[1];
            switch (reports)
            {
            case EnumReports.RptBrand:
                repCol[0] = GetBrand();
                break;

            case EnumReports.RptCostCenter:
                repCol[0] = GetCostCenter();
                break;

            case EnumReports.RptJournal:
                repCol[0] = GetJournalDet(viewModel.DateFrom, viewModel.DateTo, viewModel.CostCenterId);
                break;

            case EnumReports.RptNeraca:
                repCol[0] = GetRecAccount(EnumAccountCatType.NERACA, viewModel.CostCenterId, viewModel.RecPeriodId);
                break;

            case EnumReports.RptLR:
                repCol[0] = GetRecAccount(EnumAccountCatType.LR, viewModel.CostCenterId, viewModel.RecPeriodId);
                break;

            case EnumReports.RptStockCard:
                repCol[0] = GetStockCard(viewModel.DateFrom, viewModel.DateTo, viewModel.ItemId, viewModel.WarehouseId);
                break;

            case EnumReports.RptStockItem:
                repCol[0] = GetStockItem(viewModel.ItemId, viewModel.WarehouseId);
                break;

            case EnumReports.RptAnalyzeBudgetDetail:
                repCol[0] = GetTransDetForBudget(viewModel.ItemId, viewModel.WarehouseId);
                break;

            case EnumReports.RptPrintFacturService:
                repCol = new ReportDataSource[3];
                TTrans trans = _tTransRepository.Get(viewModel.TransId);
                repCol[0] = GetTrans(trans);
                repCol[1] = GetTransDet(trans.TransDets);
                repCol[2] = GetTransRoom(viewModel.TransId);
                break;

            case EnumReports.RptServiceOmzet:
                repCol = new ReportDataSource[2];
                TShift s = _tShiftRepository.GetByDateAndShiftNo(viewModel.DateFrom, viewModel.ShiftNo);
                repCol[0] = GetShiftViewModel(s);
                repCol[1] = GetServiceOmzet(s.ShiftDateFrom, s.ShiftDateTo);
                break;

            case EnumReports.RptCommissionRecap:
                repCol[0] = GetTransDetByDate(viewModel.DateFrom, viewModel.DateTo);
                break;

            case EnumReports.RptCommission:
                repCol[0] = GetTransDetByDate(viewModel.DateFrom, viewModel.DateTo);
                break;

            case EnumReports.RptCustomerBirthday:
                repCol[0] = GetCustomerBirthday(viewModel.DateFrom, viewModel.DateTo);
                break;
            }
            Session["ReportData"] = repCol;

            var e = new
            {
                Success   = true,
                Message   = "redirect",
                UrlReport = string.Format("{0}", reports.ToString())
            };

            return(Json(e, JsonRequestBehavior.AllowGet));
            //string reportType = formCollection["ExportFormat"];
            //string mimeType, encoding, fileNameExtension;

            ////The DeviceInfo settings should be changed based on the reportType
            ////http://msdn2.microsoft.com/en-us/library/ms155397.aspx

            //string deviceInfo =
            //"<DeviceInfo>" +
            //string.Format("  <OutputFormat>{0}</OutputFormat>", formCollection["ExportFormat"]) +
            //"  <PageWidth>8.5in</PageWidth>" +
            //"  <PageHeight>11in</PageHeight>" +
            //"  <MarginTop>0.5in</MarginTop>" +
            //"  <MarginLeft>0.5in</MarginLeft>" +
            //"  <MarginRight>0.5in</MarginRight>" +
            //"  <MarginBottom>0.5in</MarginBottom>" +
            //"</DeviceInfo>";

            //Warning[] warnings;
            //string[] streams;
            //byte[] renderedBytes;

            ////Render the report
            //renderedBytes = localReport.Render(
            //    reportType,
            //    deviceInfo,
            //    out mimeType,
            //    out encoding,
            //    out fileNameExtension,
            //    out streams,
            //    out warnings);

            //Response.AddHeader("content-disposition", string.Format("attachment; filename={0}.{1}", reports.ToString(), fileNameExtension));

            //return File(renderedBytes, mimeType);
        }
Exemple #19
0
        public ActionResult Index(EnumReports rpt)
        {
            string           title = string.Empty;
            ReportsViewModel rptVM = new ReportsViewModel();

            switch (rpt)
            {
            case EnumReports.RptWODailyRecap:
                rptVM.Title        = "Laporan Harian Servis";
                rptVM.ShowDateFrom = true;
                rptVM.ShowDateTo   = true;
                break;

            case EnumReports.RptMasterCustomer:
                rptVM.Title        = "Daftar Konsumen";
                rptVM.ShowDateFrom = false;
                rptVM.ShowDateTo   = false;
                break;

            case EnumReports.RptMasterEmp:
                rptVM.Title        = "Daftar Karyawan";
                rptVM.ShowDateFrom = false;
                rptVM.ShowDateTo   = false;
                break;

            case EnumReports.RptMasterUnitType:
                rptVM.Title        = "Daftar Tipe Unit";
                rptVM.ShowDateFrom = false;
                rptVM.ShowDateTo   = false;
                break;

            case EnumReports.RptMasterUnitMerk:
                rptVM.Title        = "Daftar Merk Unit";
                rptVM.ShowDateFrom = false;
                rptVM.ShowDateTo   = false;
                break;

            case EnumReports.RptMasterSPart:
                rptVM.Title        = "Daftar Spare Part";
                rptVM.ShowDateFrom = false;
                rptVM.ShowDateTo   = false;
                break;

            case EnumReports.RptMasterEquip:
                rptVM.Title        = "Daftar Perlengkapan";
                rptVM.ShowDateFrom = false;
                rptVM.ShowDateTo   = false;
                break;

            case EnumReports.RptWOTrack:
                rptVM.Title        = "Laporan Posisi Unit";
                rptVM.ShowDateFrom = true;
                rptVM.ShowDateTo   = true;
                break;

            case EnumReports.RptWOSpartUsed:
                rptVM.Title        = "Laporan Pemakaian Spare Part";
                rptVM.ShowDateFrom = true;
                rptVM.ShowDateTo   = true;
                break;
            }
            return(View(rptVM));
        }
        public ActionResult Report(EnumReports reports, ReportParamViewModel viewModel, FormCollection formCollection, EnumReportGroupBy?groupBy = null)
        {
            //LocalReport localReport = new LocalReport();
            //localReport.ReportPath = Server.MapPath(string.Format("~/Views/Transaction/Report/{0}.rdlc", reports.ToString()));

            ReportDataSource[] repCol     = new ReportDataSource[1];
            ReportParameter[]  parameters = null;
            switch (reports)
            {
            case EnumReports.RptBrand:
                repCol[0] = GetBrand();
                break;

            case EnumReports.RptCostCenter:
                repCol[0] = GetCostCenter();
                break;

            case EnumReports.RptNeraca:
                repCol[0] = GetRecAccount(EnumAccountCatType.NERACA, viewModel.CostCenterId, viewModel.RecPeriodId, viewModel.GenerateDetail);
                break;

            case EnumReports.RptLR:
                repCol[0] = GetRecAccount(EnumAccountCatType.LR, viewModel.CostCenterId, viewModel.RecPeriodId, viewModel.GenerateDetail);
                break;

            case EnumReports.RptNeracaSum:
                repCol[0] = GetRecAccount(EnumAccountCatType.NERACA, viewModel.CostCenterId, viewModel.RecPeriodId, viewModel.GenerateDetail);
                break;

            case EnumReports.RptLRSum:
                repCol[0] = GetRecAccount(EnumAccountCatType.LR, viewModel.CostCenterId, viewModel.RecPeriodId, viewModel.GenerateDetail);
                break;

            case EnumReports.RptStockCard:
                repCol[0] = GetStockCard(viewModel.DateFrom, viewModel.DateTo, viewModel.ItemId, viewModel.WarehouseId);
                break;

            case EnumReports.RptStockItem:
                repCol[0] = GetStockItem(viewModel.ItemId, viewModel.WarehouseId);
                break;

            case EnumReports.RptAnalyzeBudgetDetail:
                repCol[0] = GetTransDetForBudget(viewModel.ItemId, viewModel.WarehouseId, viewModel.DateFrom.Value, viewModel.DateTo.Value);
                break;

            case EnumReports.RptTransDetail:
                EnumTransactionStatus stat =
                    (EnumTransactionStatus)Enum.Parse(typeof(EnumTransactionStatus), formCollection["TransStatus"]);
                repCol[0] = GetTransTotal(viewModel.DateFrom, viewModel.DateTo, viewModel.WarehouseId, stat);
                break;

            case EnumReports.RptTransRecap:
                stat =
                    (EnumTransactionStatus)Enum.Parse(typeof(EnumTransactionStatus), formCollection["TransStatus"]);
                parameters    = new ReportParameter[3];
                parameters[0] = new ReportParameter("ParamTitle", string.Format(CommonHelper.GetStringValue(EnumReports.RptTransRecap), CommonHelper.GetStringValue(stat), CommonHelper.GetStringValue(groupBy)));
                parameters[1] = new ReportParameter("ParamGroupBy", groupBy.ToString());
                parameters[2] = new ReportParameter("ParamGroupByTitle", CommonHelper.GetStringValue(groupBy));
                repCol[0]     = GetTransTotal(viewModel.DateFrom, viewModel.DateTo, viewModel.WarehouseId, stat);
                break;

            case EnumReports.RptItem:
                repCol[0] = GetItemViewModel();
                break;

            case EnumReports.RptJournal:
                repCol[0] = GetJournalDet(viewModel.DateFrom, viewModel.DateTo, viewModel.CostCenterId, viewModel.AccountId);
                break;

            case EnumReports.RptBukuBesar:
                repCol[0] = GetJournalDetFlow(viewModel.DateFrom, viewModel.DateTo, viewModel.CostCenterId, viewModel.AccountId, viewModel.AccountIdTo);
                break;

            case EnumReports.RptJournalByCostCenter:
                repCol[0] = GetJournalDet(viewModel.DateFrom, viewModel.DateTo, viewModel.CostCenterId, viewModel.AccountId);
                break;

            case EnumReports.RptBukuBesarByCostCenter:
                repCol[0] = GetJournalDetFlow(viewModel.DateFrom, viewModel.DateTo, viewModel.CostCenterId, viewModel.AccountId, viewModel.AccountIdTo);
                break;
            }
            Session["ReportData"]  = repCol;
            Session["ReportParam"] = parameters;

            var e = new
            {
                Success   = true,
                Message   = "redirect",
                UrlReport = string.Format("{0}", reports.ToString())
            };

            return(Json(e, JsonRequestBehavior.AllowGet));
        }
        public ActionResult ReportTrans(EnumReports reports, EnumTransactionStatus TransStatus, EnumReportGroupBy?groupBy = null)
        {
            ReportParamViewModel viewModel = ReportParamViewModel.CreateReportParamViewModel(_mCostCenterRepository, _mWarehouseRepository, _mSupplierRepository, _tRecPeriodRepository, _mItemRepository);

            if (TransStatus != EnumTransactionStatus.None)
            {
                viewModel.TransStatus = TransStatus;
            }
            string title = Helper.CommonHelper.GetStringValue(reports);

            switch (reports)
            {
            case EnumReports.RptBrand:

                break;

            case EnumReports.RptCostCenter:
                break;

            case EnumReports.RptNeraca:
                viewModel.ShowCostCenter     = true;
                viewModel.ShowRecPeriod      = true;
                viewModel.ShowGenerateDetail = true;
                break;

            case EnumReports.RptLR:
                viewModel.ShowCostCenter     = true;
                viewModel.ShowRecPeriod      = true;
                viewModel.ShowGenerateDetail = true;
                break;

            case EnumReports.RptNeracaSum:
                viewModel.ShowRecPeriod      = true;
                viewModel.ShowGenerateDetail = true;
                break;

            case EnumReports.RptLRSum:
                viewModel.ShowRecPeriod      = true;
                viewModel.ShowGenerateDetail = true;
                break;

            case EnumReports.RptStockCard:
                viewModel.ShowDateFrom  = true;
                viewModel.ShowDateTo    = true;
                viewModel.ShowItem      = true;
                viewModel.ShowWarehouse = true;
                break;

            case EnumReports.RptStockItem:
                viewModel.ShowItem      = true;
                viewModel.ShowWarehouse = true;
                break;

            case EnumReports.RptAnalyzeBudgetDetail:
                viewModel.ShowDateFrom  = true;
                viewModel.ShowDateTo    = true;
                viewModel.ShowItem      = true;
                viewModel.ShowWarehouse = true;
                break;

            case EnumReports.RptTransDetail:
                title = string.Format(title, Helper.CommonHelper.GetStringValue(viewModel.TransStatus));
                switch (viewModel.TransStatus)
                {
                case EnumTransactionStatus.PurchaseOrder:
                    viewModel.ShowDateFrom  = true;
                    viewModel.ShowDateTo    = true;
                    viewModel.ShowWarehouse = true;
                    viewModel.ShowSupplier  = true;
                    break;

                case EnumTransactionStatus.Received:
                    viewModel.ShowDateFrom  = true;
                    viewModel.ShowDateTo    = true;
                    viewModel.ShowWarehouse = true;
                    viewModel.ShowSupplier  = true;
                    break;

                case EnumTransactionStatus.Purchase:
                    viewModel.ShowDateFrom  = true;
                    viewModel.ShowDateTo    = true;
                    viewModel.ShowWarehouse = true;
                    viewModel.ShowSupplier  = true;
                    break;

                case EnumTransactionStatus.ReturPurchase:
                    viewModel.ShowDateFrom  = true;
                    viewModel.ShowDateTo    = true;
                    viewModel.ShowWarehouse = true;
                    viewModel.ShowSupplier  = true;
                    break;

                case EnumTransactionStatus.Using:
                    viewModel.ShowDateFrom  = true;
                    viewModel.ShowDateTo    = true;
                    viewModel.ShowWarehouse = true;
                    break;

                case EnumTransactionStatus.Mutation:
                    viewModel.ShowDateFrom  = true;
                    viewModel.ShowDateTo    = true;
                    viewModel.ShowWarehouse = true;
                    break;

                case EnumTransactionStatus.Budgeting:
                    //viewModel.ShowDateFrom = true;
                    //viewModel.ShowDateTo = true;
                    viewModel.ShowWarehouse = true;
                    break;
                }

                break;

            case EnumReports.RptTransRecap:

                string groupByTitle = groupBy != null?Helper.CommonHelper.GetStringValue(groupBy) : string.Empty;

                title = string.Format(title, Helper.CommonHelper.GetStringValue(viewModel.TransStatus), groupByTitle);
                switch (viewModel.TransStatus)
                {
                case EnumTransactionStatus.PurchaseOrder:
                    viewModel.ShowDateFrom  = true;
                    viewModel.ShowDateTo    = true;
                    viewModel.ShowWarehouse = true;
                    viewModel.ShowSupplier  = true;
                    break;

                case EnumTransactionStatus.Received:
                    viewModel.ShowDateFrom  = true;
                    viewModel.ShowDateTo    = true;
                    viewModel.ShowWarehouse = true;
                    viewModel.ShowSupplier  = true;
                    break;

                case EnumTransactionStatus.Purchase:
                    viewModel.ShowDateFrom  = true;
                    viewModel.ShowDateTo    = true;
                    viewModel.ShowWarehouse = true;
                    viewModel.ShowSupplier  = true;
                    break;

                case EnumTransactionStatus.ReturPurchase:
                    viewModel.ShowDateFrom  = true;
                    viewModel.ShowDateTo    = true;
                    viewModel.ShowWarehouse = true;
                    viewModel.ShowSupplier  = true;
                    break;

                case EnumTransactionStatus.Using:
                    viewModel.ShowDateFrom  = true;
                    viewModel.ShowDateTo    = true;
                    viewModel.ShowWarehouse = true;
                    break;

                case EnumTransactionStatus.Mutation:
                    viewModel.ShowDateFrom  = true;
                    viewModel.ShowDateTo    = true;
                    viewModel.ShowWarehouse = true;
                    break;

                case EnumTransactionStatus.Budgeting:
                    //viewModel.ShowDateFrom = true;
                    //viewModel.ShowDateTo = true;
                    viewModel.ShowWarehouse = true;
                    break;
                }

                break;

            case EnumReports.RptItem:

                break;

            case EnumReports.RptJournal:
                viewModel.ShowDateFrom  = true;
                viewModel.ShowDateTo    = true;
                viewModel.ShowAccount   = false;
                viewModel.ShowAccountTo = false;
                break;

            case EnumReports.RptBukuBesar:
                viewModel.ShowDateFrom  = true;
                viewModel.ShowDateTo    = true;
                viewModel.ShowAccount   = true;
                viewModel.ShowAccountTo = true;
                break;

            case EnumReports.RptJournalByCostCenter:
                viewModel.ShowDateFrom   = true;
                viewModel.ShowDateTo     = true;
                viewModel.ShowCostCenter = true;
                viewModel.ShowAccount    = false;
                viewModel.ShowAccountTo  = false;
                break;

            case EnumReports.RptBukuBesarByCostCenter:
                viewModel.ShowDateFrom   = true;
                viewModel.ShowDateTo     = true;
                viewModel.ShowCostCenter = true;
                viewModel.ShowAccount    = true;
                viewModel.ShowAccountTo  = true;
                break;
            }
            ViewData["CurrentItem"]  = title;
            ViewData["ExportFormat"] = new SelectList(Enum.GetValues(typeof(EnumExportFormat)));

            return(View(viewModel));
        }
        public ActionResult Report(EnumReports reports)
        {
            ReportParamViewModel viewModel = ReportParamViewModel.CreateReportParamViewModel(_mCostCenterRepository, _mWarehouseRepository, _mSupplierRepository, _tRecPeriodRepository, _mItemRepository);
            string title = string.Empty;

            switch (reports)
            {
            case EnumReports.RptBrand:
                title = "Daftar Master Merek";

                break;

            case EnumReports.RptCostCenter:
                title = "Daftar Master Cost Center";
                break;

            case EnumReports.RptJournal:
                title = "Daftar Jurnal";
                viewModel.ShowDateFrom   = true;
                viewModel.ShowDateTo     = true;
                viewModel.ShowCostCenter = true;
                break;

            case EnumReports.RptNeraca:
                title = "Laporan Neraca";
                viewModel.ShowCostCenter = true;
                viewModel.ShowRecPeriod  = true;
                break;

            case EnumReports.RptLR:
                title = "Laporan Laba / Rugi";
                viewModel.ShowCostCenter = true;
                viewModel.ShowRecPeriod  = true;
                break;

            case EnumReports.RptStockCard:
                title = "Kartu Stok";
                viewModel.ShowDateFrom  = true;
                viewModel.ShowDateTo    = true;
                viewModel.ShowItem      = true;
                viewModel.ShowWarehouse = true;
                break;

            case EnumReports.RptStockItem:
                title = "Lap. Stok Per Gudang";
                viewModel.ShowItem      = true;
                viewModel.ShowWarehouse = true;
                break;

            case EnumReports.RptAnalyzeBudgetDetail:
                title = "Lap. Analisa Budget";
                viewModel.ShowItem      = true;
                viewModel.ShowWarehouse = true;
                break;

            case EnumReports.RptServiceOmzet:
                title = "Lap. Omzet Penjualan";
                viewModel.ShowShiftNo  = true;
                viewModel.ShowDateFrom = true;
                break;

            case EnumReports.RptCommissionRecap:
                title = "Lap. Rekap Komisi Terapis";
                viewModel.ShowDateFrom = true;
                viewModel.ShowDateTo   = true;
                break;

            case EnumReports.RptCommission:
                title = "Lap. Komisi Terapis";
                viewModel.ShowDateFrom = true;
                viewModel.ShowDateTo   = true;
                break;

            case EnumReports.RptCustomerBirthday:
                title = "Daftar Member Ulang Tahun";
                //viewModel.ShowDateFrom = true;
                //viewModel.ShowDateTo = true;
                break;
            }
            ViewData["CurrentItem"] = title;


            ViewData["ExportFormat"] = new SelectList(Enum.GetValues(typeof(EnumExportFormat)));

            return(View(viewModel));
        }
Exemple #23
0
        public ActionResult Report(EnumReports reports, DateTime?dateFrom = null, DateTime?dateTo = null, string customerId = null)
        {
            ReportParamViewModel viewModel = ReportParamViewModel.CreateReportParamViewModel(_mCostCenterRepository, _mWarehouseRepository, _mSupplierRepository, _tRecPeriodRepository, _mItemRepository);
            string title = string.Empty;

            switch (reports)
            {
            case EnumReports.RptBrand:
                title = "Daftar Master Merek";

                break;

            case EnumReports.RptCostCenter:
                title = "Daftar Master Cost Center";
                break;

            case EnumReports.RptJournal:
                title = "Daftar Jurnal";
                viewModel.ShowDateFrom   = true;
                viewModel.ShowDateTo     = true;
                viewModel.ShowCostCenter = true;
                break;

            case EnumReports.RptNeraca:
                title = "Laporan Neraca";
                viewModel.ShowDateFrom   = true;
                viewModel.ShowDateTo     = true;
                viewModel.ShowCostCenter = true;
                break;

            case EnumReports.RptLR:
                title = "Laporan Laba / Rugi";
                viewModel.ShowCostCenter = true;
                viewModel.ShowRecPeriod  = true;
                break;

            case EnumReports.RptStockCard:
                title = "Kartu Stok";
                viewModel.ShowDateFrom  = true;
                viewModel.ShowDateTo    = true;
                viewModel.ShowItem      = true;
                viewModel.ShowWarehouse = true;
                break;

            case EnumReports.RptStockItem:
                title = "Lap. Stok Per Gudang";
                viewModel.ShowItem      = true;
                viewModel.ShowWarehouse = true;
                break;

            case EnumReports.RptAnalyzeBudgetDetail:
                title = "Lap. Analisa Budget";
                viewModel.ShowItem      = true;
                viewModel.ShowWarehouse = true;
                break;

            case EnumReports.RptServiceOmzet:
                title = "Lap. Omzet Penjualan";
                viewModel.ShowDateFrom = true;
                viewModel.ShowDateTo   = true;
                break;

            case EnumReports.RptCommission:
                title = "Lap. Komisi Karyawan";
                viewModel.ShowDateFrom = true;
                viewModel.ShowDateTo   = true;
                break;

            case EnumReports.RptSalesByAction:
                title = "Lap. Penjualan Berdasar Jlh Tindakan";
                viewModel.ShowDateFrom = true;
                viewModel.ShowDateTo   = true;
                break;

            case EnumReports.RptBukuBesar:
                title = "Laporan Buku Besar";
                viewModel.ShowDateFrom   = true;
                viewModel.ShowDateTo     = true;
                viewModel.ShowCostCenter = true;
                break;

            case EnumReports.RptCommissionRecap:
                title = "Lap. Rekap Komisi Karyawan";
                viewModel.ShowDateFrom = true;
                viewModel.ShowDateTo   = true;
                break;

            case EnumReports.RptServiceByCustomer:
                title = "Lap. Tindakan Per Pasien";
                viewModel.ShowCustomer = true;
                viewModel.ShowDateFrom = true;
                viewModel.ShowDateTo   = true;

                viewModel.DateFrom   = dateFrom;
                viewModel.DateTo     = dateTo;
                viewModel.CustomerId = customerId;
                break;
            }
            ViewData["CurrentItem"] = title;


            ViewData["ExportFormat"] = new SelectList(Enum.GetValues(typeof(EnumExportFormat)));

            return(View(viewModel));
        }
        public ActionResult PrintWOFactur(string random, string woId)
        {
            string      msg        = string.Empty;
            bool        success    = false;
            bool        allowPrint = true;
            EnumReports rptToPrint = EnumReports.RptPrintWOFactur;

            try
            {
                //get wo by wo id
                TWO wo = this._woTasks.One(woId);
                //check if user have print WO, if not, allow print for role CS
                if (User.IsInRole("CS"))
                {
                    allowPrint = !_woLogTasks.HaveBeenPrint(wo, User.Identity.Name);
                }

                if (allowPrint)
                {
                    ReportParameterCollection paramCol = null;
                    ReportDataSource[]        repCol   = new ReportDataSource[1];
                    //get data source
                    IList <WOViewModel> listWO           = GetWOById(wo);
                    ReportDataSource    reportDataSource = new ReportDataSource("WOViewModel", listWO);
                    repCol[0] = reportDataSource;
                    //set rpt to print
                    switch (listWO[0].MerkName)
                    {
                    case "CROSS": rptToPrint = EnumReports.RptPrintWOFacturEvercoss;
                        break;

                    case "ADVAN": rptToPrint = EnumReports.RptPrintWOFacturAdvan;
                        break;

                    default: rptToPrint = EnumReports.RptPrintWOFacturGJCell;
                        break;
                    }

                    //save log
                    SaveLog(wo, EnumWOLog.Print);

                    Session["ReportData"]   = repCol;
                    Session["ReportParams"] = paramCol;

                    success = true;
                    msg     = "Print WO success";
                }
                else
                {
                    success = false;
                    msg     = "Anda sudah pernah mencetak WO";
                }
            }
            catch (Exception ex)
            {
                success = false;
                msg     = ex.GetBaseException().Message;
            }
            var e = new
            {
                Success   = success,
                Message   = msg,
                UrlReport = string.Format("{0}&rs%3aFormat=HTML4.0", rptToPrint.ToString())
            };

            return(Json(e, JsonRequestBehavior.AllowGet));
        }
Exemple #25
0
 public ActionResult ReportTrans(EnumReports reports, ReportParamViewModel viewModel, FormCollection formCollection)
 {
     return(Report(reports, viewModel, formCollection));
 }