Пример #1
0
 public JsonResult GrafikProductSalesReport(string fromDate, string toDate)
 {
     DateTime from = new DateTime(int.Parse(fromDate.Split('-')[2]), int.Parse(fromDate.Split('-')[1]), int.Parse(fromDate.Split('-')[0]));
     DateTime to = new DateTime(int.Parse(toDate.Split('-')[2]), int.Parse(toDate.Split('-')[1]), int.Parse(toDate.Split('-')[0]));
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     IList<GrafikProductSalesReport> results = SalesReportRepository.FindGrafikProductSalesReport(cp.BranchId, from, to);
     return Json(results, JsonRequestBehavior.AllowGet);
 }
Пример #2
0
 public JsonResult TransactionListing(string fromDate, string toDate)
 {
     DateTime from = new DateTime(int.Parse(fromDate.Split('-')[2]), int.Parse(fromDate.Split('-')[1]), int.Parse(fromDate.Split('-')[0]));
     DateTime to = new DateTime(int.Parse(toDate.Split('-')[2]), int.Parse(toDate.Split('-')[1]), int.Parse(toDate.Split('-')[0]));
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     IList<TransactionListing> transactions = StatementRepository.GetStatement(cp.BranchId, from, to, "Kas");
     return Json(transactions, JsonRequestBehavior.AllowGet);
 }
Пример #3
0
 public JsonResult RateProductPurchaseReport(string fromDate, string toDate, int periority)
 {
     DateTime from = new DateTime(int.Parse(fromDate.Split('-')[2]), int.Parse(fromDate.Split('-')[1]), int.Parse(fromDate.Split('-')[0]));
     DateTime to = new DateTime(int.Parse(toDate.Split('-')[2]), int.Parse(toDate.Split('-')[1]), int.Parse(toDate.Split('-')[0]));
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     IList<RateProductPurchaseReport> results = PurchaseRepository.FindRateProductPurchaseReport(cp.BranchId, from, to, periority);
     return Json(results, JsonRequestBehavior.AllowGet);
 }
Пример #4
0
 public JsonResult DailySalesReport()
 {
     DateTime now = DateTime.Now;
     DateTime to = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0);
     DateTime from = now.AddDays(-30);
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     IList<DailySalesReport> results = SalesReportRepository.FindDailySalesReport(cp.BranchId, from, to);
     return Json(results, JsonRequestBehavior.AllowGet);
 }
Пример #5
0
 public ActionResult Logo()
 {
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     //Image img = Image.FromFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Content\img\logoorg\" + cp.BranchId + ".png"));
     //MemoryStream ms = new MemoryStream();
     //img.Save(ms, ImageFormat.Png);
     LogoOrganization logoOrg = OrganizationRepository.GetLogoOrganization(cp.BranchId);
     return File(logoOrg.Image, "image/png");
 }
Пример #6
0
        public JsonResult Lists(int offset, string status, bool search, string key)
        {
            CompanyProfile cp = new CompanyProfile(this.HttpContext);
            IList<ProductReport> listView = new List<ProductReport>();
            if (search)
                listView = ProductRepository.SearchListView(cp.BranchId, offset, key);
            else
                listView = ProductRepository.GetListView(cp.BranchId, offset, status);

            return Json(listView, JsonRequestBehavior.AllowGet);
        }
Пример #7
0
 public JsonResult Customer(Customer cust)
 {
     try
     {
         CompanyProfile cp = new CompanyProfile(this.HttpContext);
         cust.id = Guid.NewGuid();
         cust.BranchId = cp.BranchId;
         CustomerService.Create(cust);
         return Json(new { error = false, data = cust }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(new { error = true, message = ex.Message }, JsonRequestBehavior.AllowGet);
     }
 }
Пример #8
0
 public JsonResult BayarAngsuran(Guid invoiceId, string date, int totalBulanYangDiBayar, decimal payAmount)
 {
     try
     {
         string[] stringDate = date.Split('-');
         DateTime paymentDate = new DateTime(int.Parse(stringDate[2]), int.Parse(stringDate[1]), int.Parse(stringDate[0]));
         CompanyProfile cp = new CompanyProfile(this.HttpContext);
         InvoiceService.BayarAngsuran(invoiceId, paymentDate, totalBulanYangDiBayar, payAmount, cp.UserName);
         return Json(new { error = false, data = new { InvoiceId = invoiceId } }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(new { error = true, message = ex.Message }, JsonRequestBehavior.AllowGet);
     }
 }
Пример #9
0
 public JsonResult CreatePurchase(SupplierInvoice si)
 {
     try
     {
         CompanyProfile cp = new CompanyProfile(this.HttpContext);
         si.BranchId = cp.BranchId;
         si.id = Guid.NewGuid();
         si.ProductId = Guid.NewGuid();
         SupplierInvoiceService.Create(si, cp.UserName);
         return Json(new { error = false, data = si }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(new { error = true, message = ex.Message }, JsonRequestBehavior.AllowGet);
     }
 }
Пример #10
0
 public JsonResult AddUser(string username, string password, string email, string role)
 {
     try
     {
         CompanyProfile cp = new CompanyProfile(this.HttpContext);
         Users user = Membership.CreateUser(username, password, email);
         user.BranchId = cp.BranchId;
         user.OwnerId = cp.OwnerId;
         Membership.UpdateUser(user);
         Roles.AddUserToRole(user.Name, role);
         return Json(new { error = false, data = user }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(new { error = true, message = ex.Message });
     }
 }
Пример #11
0
 public JsonResult ChangePassword(string oldpassword, string newpassword, string confirmnewpassword)
 {
     try
     {
         CompanyProfile cp = new CompanyProfile(this.HttpContext);
         bool changePasswordSucceeded;
         MembershipUser currentUser = Membership.GetUser(User.Identity.Name, true /* userIsOnline */);
         changePasswordSucceeded = currentUser.ChangePassword(oldpassword, newpassword);
         if (changePasswordSucceeded)
         {
             return Json(new { error = false, data = string.Empty }, JsonRequestBehavior.AllowGet);
         }
         else
         {
             return Json(new { error = true, message = "Gagal ganti password" }, JsonRequestBehavior.AllowGet);
         }
     }
     catch (Exception ex)
     {
         return Json(new { error = true, message = ex.Message }, JsonRequestBehavior.AllowGet);
     }
 }
Пример #12
0
 public JsonResult Booking(BookingCommand cmd)
 {
     try
     {
         CompanyProfile cp = new CompanyProfile(this.HttpContext);
         cmd.id = Guid.NewGuid();
         cmd.BranchId = cp.BranchId;
         InvoiceService.Booking(cmd, cp.UserName);
         return Json(new { error = false, data = cmd }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(new { error = true, message = ex.Message }, JsonRequestBehavior.AllowGet);
     }
 }
Пример #13
0
 public JsonResult TotalList()
 {
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     TotalInvoice result = InvoiceReportRepository.GetTotalListView(cp.BranchId);
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Пример #14
0
 public JsonResult Remove(Guid id)
 {
     try
     {
         CompanyProfile cp = new CompanyProfile(this.HttpContext);
         InvoiceService.Remove(id, cp.UserName);
         return Json(new { error = false, data = id }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(new { error = true, message = ex.Message }, JsonRequestBehavior.AllowGet);
     }
 }
Пример #15
0
 public ActionResult UpdateLogo(HttpPostedFileBase image)
 {
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     Stream stream = image.InputStream;
     Image img = Image.FromStream(stream);
     OrganizationService.SaveLogo(img, cp.BranchId);
     return RedirectToAction("Index");
 }
Пример #16
0
 public JsonResult TotalList()
 {
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     TotalCustomer total = CustomerRepository.GetTotalList(cp.BranchId);
     return Json(total, JsonRequestBehavior.AllowGet);
 }
Пример #17
0
 public JsonResult YearlyPurchaseReport(int fromYear, int toYear)
 {
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     IList<YearlyPurchaseReport> results = PurchaseRepository.FindYearlyPurchaseReport(cp.BranchId, fromYear, toYear);
     return Json(results, JsonRequestBehavior.AllowGet);
 }
Пример #18
0
 public JsonResult ChangeUangMuka(Guid invoiceId, decimal uangmuka)
 {
     try
     {
         CompanyProfile cp = new CompanyProfile(this.HttpContext);
         InvoiceService.ChangeUangMuka(invoiceId, uangmuka, cp.UserName);
         return Json(new { error = false, data = new { id = invoiceId } }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(new { error = true, message = ex.Message }, JsonRequestBehavior.AllowGet);
     }
 }
Пример #19
0
 public JsonResult ChangeLamaAngsuran(Guid invoiceId, int lamaAngsuran)
 {
     try
     {
         CompanyProfile cp = new CompanyProfile(this.HttpContext);
         InvoiceService.ChangeLamaAngsuran(invoiceId, lamaAngsuran, cp.UserName);
         return Json(new { error = false, data = new { id = invoiceId } }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(new { error = true, message = ex.Message }, JsonRequestBehavior.AllowGet);
     }
 }
Пример #20
0
 public JsonResult ChangeInvoiceDate(Guid invoiceId, string invoiceDate)
 {
     try
     {
         string[] stringDate = invoiceDate.Split('-');
         DateTime date = new DateTime(int.Parse(stringDate[2]), int.Parse(stringDate[1]), int.Parse(stringDate[0]));
         CompanyProfile cp = new CompanyProfile(this.HttpContext);
         InvoiceService.ChangeInvoiceDate(invoiceId, date, cp.UserName);
         return Json(new { error = false, data = new { id = invoiceId } }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(new { error = true, message = ex.Message }, JsonRequestBehavior.AllowGet);
     }
 }
Пример #21
0
 public JsonResult UpdateProfile(Organization newOrg)
 {
     try
     {
         if (newOrg != null)
         {
             CompanyProfile cp = new CompanyProfile(this.HttpContext);
             Organization org = OrganizationRepository.GetOrganization(cp.BranchId);
             newOrg.BranchId = org.BranchId;
             OrganizationService.Update(newOrg);
             return Json(new { error = false, data= newOrg }, JsonRequestBehavior.AllowGet);
         }
         return Json(new { error = true, message = "Gagal ubah profil perusahaan." }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(new { error = true, message = ex.Message }, JsonRequestBehavior.AllowGet);
     }
 }
Пример #22
0
 public JsonResult MonthlyPurchaseReport(int year)
 {
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     IList<MonthlyPurchaseReport> results = PurchaseRepository.FindMonthlyPurchaseReport(cp.BranchId, year);
     return Json(results, JsonRequestBehavior.AllowGet);
 }
Пример #23
0
 public JsonResult HeaderReport(Guid invId)
 {
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     InvoiceHeaderReport headerReport = InvoiceReportRepository.GetHeader(invId, cp.BranchId);
     return Json(headerReport, JsonRequestBehavior.AllowGet);
 }
Пример #24
0
 public JsonResult ProfileOrganization()
 {
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     Organization org = OrganizationRepository.GetOrganization(cp.BranchId);
     return Json(org, JsonRequestBehavior.AllowGet);
 }
Пример #25
0
 public JsonResult Search(string key)
 {
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     IList<CustomerSearch> result = CustomerRepository.Search(key, cp.BranchId);
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Пример #26
0
 public JsonResult ItemsReport(Guid invId)
 {
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     IList<InvoiceItemReport> items = InvoiceReportRepository.GetItems(invId, cp.BranchId);
     return Json(items, JsonRequestBehavior.AllowGet);
 }
Пример #27
0
 public JsonResult UpdateCustomer(Customer cust)
 {
     try
     {
         CompanyProfile cp = new CompanyProfile(this.HttpContext);
         CustomerService.Update(cust);
         return Json(new { error = false, data = cust }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(new { error = true, message = ex.Message }, JsonRequestBehavior.AllowGet);
     }
 }
Пример #28
0
 public FileStreamResult PrintSuratPeringatan(Guid id, string date)
 {
     string[] stringDate = date.Split('-');
     DateTime dateOfIssue = new DateTime(int.Parse(stringDate[2]), int.Parse(stringDate[1]), int.Parse(stringDate[0]));
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     string template = PrintDocument.PrintSuratPeringatan(id, dateOfIssue, cp.BranchId);
     MemoryStream resultStream = ConvertToHtml(template, new RectangleF(0.5f, 0.1f, 7.3f, 12.1f));
     return new FileStreamResult(resultStream, "application/pdf");
 }
Пример #29
0
 public JsonResult Terms()
 {
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     IList<PaymentTermReport> result = PaymentTermRepository.FindAll(cp.OwnerId);
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Пример #30
0
 public FileStreamResult PrintSuratTandaTerima(Guid id)
 {
     CompanyProfile cp = new CompanyProfile(this.HttpContext);
     string template = PrintDocument.PrintTandaTerima(id, cp.BranchId);
     MemoryStream resultStream = ConvertToHtml(template, new RectangleF(0.5f, 0.1f, 7.3f, 11f));
     return new FileStreamResult(resultStream, "application/pdf");
 }