Esempio n. 1
0
        public dynamic GetDefaultInfo()
        {
            CompanyInfo model = new CompanyInfo();

            try
            {
                model = _companyInfoService.GetQueryable().FirstOrDefault();
            }
            catch (Exception ex)
            {
                LOG.Error("GetInfo", ex);
                Dictionary <string, string> Errors = new Dictionary <string, string>();
                Errors.Add("Generic", "Error " + ex);

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

            return(Json(new
            {
                model.Id,
                model.Name,
                model.Address,
                model.City,
                model.PostalCode,
                model.PhoneNumber,
                model.FaxNumber,
                model.Email,
                model.Website,
                model.NPWP,
                model.NPWPDate
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public ActionResult ReportSlipGajiDetail(Nullable <int> Id, DateTime monthYear)
        {
            var company = _companyInfoService.GetQueryable().FirstOrDefault();
            var q       = _slipGajiDetailService.GetQueryable().Include("SlipGajiDetail1s").Include("SlipGajiDetail2As").Where(x => (Id == null || Id.Value == 0 || x.EmployeeId == Id.Value) && x.MONTH.Month == monthYear.Month && x.MONTH.Year == monthYear.Year);
            //.ToList();
            var q2 = _slipGajiDetail1Service.GetQueryable().Include("SlipGajiDetail").Where(x => (Id == null || Id.Value == 0 || x.SlipGajiDetail.EmployeeId == Id.Value) && x.SlipGajiDetail.MONTH.Month == monthYear.Month && x.SlipGajiDetail.MONTH.Year == monthYear.Year).ToList();
            var q3 = _slipGajiDetail2AService.GetQueryable().Include("SlipGajiDetail").Where(x => (Id == null || Id.Value == 0 || x.SlipGajiDetail.EmployeeId == Id.Value) && x.SlipGajiDetail.MONTH.Month == monthYear.Month && x.SlipGajiDetail.MONTH.Year == monthYear.Year).ToList();

            string user = AuthenticationModel.GetUserName();

            CultureInfo ci = new CultureInfo("id-ID");

            var query = (from model in q
                         select new
            {
                model.MONTH,
                model.NoBadge,
                model.Name,
                model.Jabatan,
                model.TanggalPenerimaan,
                model.PeriodeAwal,
                model.PeriodeAkhir,
                model.GajiBasis,
                model.StatusMarriage,
                model.NoSlip,
                model.Rate,
                model.Lembur15,
                model.Lembur20,
                model.Lembur30,
                model.Lembur40,
                Disiapkan_oleh = "",
                Disetujui_oleh = "",
                Dikoreksi_oleh = "",
                company_code = company.Name,
                //CompanyAddress = company.Address,
                //User = user,
                model.SlipGajiDetail1s,
                model.SlipGajiDetail2As,
            }).ToList();

            if (!query.Any())
            {
                return(Content(Core.Constants.Constant.ErrorPage.RecordDetailNotFound));
            }

            var rd = new ReportDocument();

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

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

            rd.Subreports["rpt_SlipGaji2.rpt"].SetDataSource(q2);
            rd.Subreports["rpt_SlipGaji3.rpt"].SetDataSource(q3);

            // Set parameters, need to be done after all data sources are set (to prevent reseting parameters)
            rd.SetParameterValue(0, "Periode " + monthYear.ToString("MMMM yyyy", ci).ToUpper());

            // Set printer paper size
            //System.Drawing.Printing.PrintDocument doctoprint = new System.Drawing.Printing.PrintDocument();
            //doctoprint.PrinterSettings.PrinterName = "Microsoft XPS Document Writer";
            //int i = 0;
            //for (i = 0; i < doctoprint.PrinterSettings.PaperSizes.Count; i++)
            //{
            //    int rawKind = 0;
            //    if (doctoprint.PrinterSettings.PaperSizes[i].PaperName.ToLower() == "Letter")
            //    {
            //        rawKind = Convert.ToInt32(doctoprint.PrinterSettings.PaperSizes[i].GetType().GetField("kind", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(doctoprint.PrinterSettings.PaperSizes[i]));
            //        if (Enum.IsDefined(typeof(CrystalDecisions.Shared.PaperSize), rawKind))
            //        {
            //            rd.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)rawKind;
            //            //rd.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
            //        }
            //        break;
            //    }
            //}

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

            return(File(stream, "application/pdf"));
        }
Esempio n. 3
0
        public dynamic GetList(string _search, long nd, int rows, int?page, string sidx, string sord, string filters = "")
        {
            // Construct where statement
            string strWhere = GeneralFunction.ConstructWhere(filters);
            string filter   = null;

            GeneralFunction.ConstructWhereInLinq(strWhere, out filter);
            if (filter == "")
            {
                filter = "true";
            }

            // Get Data
            var q = _companyInfoService.GetQueryable();

            var query = (from model in q
                         select new
            {
                model.Id,
                model.Name,
                model.Address,
                model.City,
                model.PostalCode,
                model.PhoneNumber,
                model.FaxNumber,
                model.Email,
                model.Website,
                model.NPWP,
                model.NPWPDate,
                model.CreatedAt,
                model.UpdatedAt,
            }).Where(filter).OrderBy(sidx + " " + sord);              //.ToList();

            var list = query.AsEnumerable();

            var pageIndex    = Convert.ToInt32(page) - 1;
            var pageSize     = rows;
            var totalRecords = query.Count();
            var totalPages   = (int)Math.Ceiling((float)totalRecords / (float)pageSize);

            // default last page
            if (totalPages > 0)
            {
                if (!page.HasValue)
                {
                    pageIndex = totalPages - 1;
                    page      = totalPages;
                }
            }

            list = list.Skip(pageIndex * pageSize).Take(pageSize);

            return(Json(new
            {
                total = totalPages,
                page = page,
                records = totalRecords,
                rows = (
                    from model in list
                    select new
                {
                    id = model.Id,
                    cell = new object[] {
                        model.Id,
                        model.Name,
                        model.Address,
                        model.City,
                        model.PostalCode,
                        model.PhoneNumber,
                        model.FaxNumber,
                        model.Email,
                        model.Website,
                        model.NPWP,
                        model.NPWPDate,
                        model.CreatedAt,
                        model.UpdatedAt,
                    }
                }).ToArray()
            }, JsonRequestBehavior.AllowGet));
        }