private void MainGrid_Load(object sender, EventArgs e) { try // new wendy.json file first { StreamReader jsonReader = File.OpenText(@"wendy.json"); invoiceHistory = JsonUtil.DeserializeJson <InvoiceHistory>(jsonReader); } catch (FileNotFoundException jsonException) { try // old wendy.xml file { StreamReader xmlReader = File.OpenText(@"wendy.xml"); var oldWendyData = XmlUtil.DeserializeXML <Model.Wendy1.OldWendyFile>(xmlReader, nameSpace: null); invoiceHistory = Tasks.Converters.OldWendyFileConverter.ToInvoiceHistory(oldWendyData); new ConsumptionCalculator(invoiceHistory).CalculateConsumption(); } catch (FileNotFoundException xmlException) { ShowErrorStatus(xmlException, jsonException.Message); } } ShowInvoiceHistory(invoiceHistory, GetPriceShowFormat()); }
public InvoiceHistory SaveInvoice(InvoiceHistory Invoice) { // Invoice Master _Context.InvoiceHistory.Add(Invoice); _Context.SaveChanges(); return(Invoice); }
public List <InvoiceHistory> Get_List_Invoice_By_CustomerID_All(string id) { List <InvoiceHistory> list = new List <InvoiceHistory>(); if (dbContext == null) { dbContext = new FoodDeliveryEntities(); } var listvar = dbContext.GET_LIST_INVOICE_BY_CUSTOMERID_ALL(id).ToList(); foreach (var obj in listvar) { InvoiceHistory entity = new InvoiceHistory { InvoiceID = "" + obj.InvoiceID, OrderDate = "" + obj.OrderDate, DeliveryDate = "" + obj.DeliveryDate, Sale = (decimal)obj.Sale, ServiceChange = (decimal)obj.ServiceChange, ShippingFee = (decimal)obj.ShippingFee, TotalPrice = (decimal)obj.TotalPrice, StoreID = "" + obj.StoreID, StoreName = obj.StoreName, StoreAddress = obj.Address, CustomerID = "" + obj.CustomerID, AddressDelivery = obj.AddressDelivery, CustomerName = obj.CustomerName, CustomerPhone = obj.CustomerPhone, Status = (int)obj.Status }; list.Add(entity); } return(list); }
public InvoiceHistory UpdateInvoice(InvoiceHistory Invoice) { // Invoice Master _Context.Entry(Invoice).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _Context.SaveChanges(); return(Invoice); }
public ActionResult EditChangeStatus(InvoiceStatusModel _objTask) { InvoiceHistory invoiceHistory = new InvoiceHistory(); invoiceHistory.History_Name = "Invoice Status Change"; invoiceHistory.Type = InvoiceStatus.InvoiceInvented; invoiceHistory.Description = ""; invoiceHistory.Invoice_Number = Convert.ToInt64(_objTask.ID); invoiceHistory.User_ID = CurrentUser.NameIdentifierInt64; invoiceHistory.Organization_ID = CurrentUser.CompanyID; invoiceHistory.Date_TIME = DateTime.Now; _CustomerBAL.create_InvoiceHistoryBAL(invoiceHistory); _objTask.Status_Name = _objTask.Type.ToString(); _objTask.Description = _objTask.Type.ToString(); _objTask.CreatedBy = CurrentUser.NameIdentifierInt64; _objTask.CreatedDate = DateTime.Now; _objTask.Invoice_ID = _objTask.ID; _objTask.Organization_ID = CurrentUser.CompanyID; var result = this._CustomerBAL.InvoiceStatusChangeCreateBAL(_objTask); if (result == -1) { ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError); } var resultData = new[] { _objTask }; return(RedirectToAction("InvoiceGrid")); }
public InvoiceHistory DeleteInvoice(InvoiceHistory Invoice) { // Invoice Master _Context.InvoiceHistory.Remove(Invoice); _Context.SaveChanges(); return(Invoice); }
public IActionResult CreateInvoice(Invoice model) { if (ModelState.IsValid) { try { InvoiceHistory IHmodel = new InvoiceHistory(); IHmodel.CustomerID = model.CustomerID; IHmodel.LayoutName = model.LayoutName ?? 1.ToString(); IHmodel.SpecificNotes = model.SpecificNotes; IHmodel.Status = model.Status; IHmodel.TotalTaxes = model.TotalTaxes; IHmodel.TotalWithoutTax = model.TotalWithoutTax; IHmodel.InvoiceDate = Convert.ToDateTime(model.InvoiceDate); IHmodel.InvoiceDueDate = Convert.ToDateTime(model.InvoiceDueDate); IHmodel.InvoiceNo = model.InvoiceNo; IHmodel.ShareableID = Guid.NewGuid().ToString(); IHmodel.TotalWithTaxes = Convert.ToDecimal(model.TotalWithoutTax) + Convert.ToDecimal(model.TotalTaxes); IHmodel.ShowPaymentButton = false; IHmodel.CreatedDate = System.DateTime.UtcNow; int RefInvoiceHistpryID = _InvoiceService.SaveInvoice(IHmodel).ID; foreach (var item in model.SlectedItems) { InvoiceHistoryProducts IHP = new InvoiceHistoryProducts(); string[] arr = item.Split('-'); int Pid = Convert.ToInt32(arr[0]); int Quantity = Convert.ToInt32(arr[1]); decimal Price = _ProductService.GetProductByID(Pid).ProductUnitPrice; IHP.ProdcutID = Pid; IHP.ProductUnitPrice = Price; IHP.ProdcutUnits = Quantity; IHP.ProdcutSubTotal = Price * Convert.ToDecimal(Quantity); IHP.InvoiceHistoryID = RefInvoiceHistpryID; _InvoiceService.SaveInvoiceProducts(IHP); } return(RedirectToAction("InvoiceHistoryList")); // need to do } catch (Exception ex) { TempData["Error"] = "Sorry, Some error occourred"; return(RedirectToAction("CreateInvoice")); } } else { model.AllStatusList = StatusList; model.LayoutName = model.LayoutName; model.AllProducts = _ProductService.AllProductListForDdl(); model.GS = _GeneralService.GetGeneralSettings(); return(View(model)); } }
public FileResult PrintInvoice_Read() { string _classID = System.Web.HttpContext.Current.Session["InvoiceID"].ToString(); string _PrintDublicate = System.Web.HttpContext.Current.Session["PrintDublicate"].ToString(); bool bit = false; if (_PrintDublicate == "True") { bit = true; } if (_classID.Equals("-1")) { Session["InvoiceID"] = -1; return(null); } else { ReIssued reIssued = new ReIssued(); reIssued.Invoice_ID = Convert.ToInt64(_classID); reIssued.Re_Issued_By = CurrentUser.NameIdentifierInt64; reIssued.Re_Issued_Date = DateTime.Now; reIssued.Organization_ID = CurrentUser.CompanyID; reIssued.ID = _CustomerBAL.create_InvoiceReIssueBAL(reIssued); InvoiceHistory invoiceHistory = new InvoiceHistory(); invoiceHistory.History_Name = "Invoice Issued"; invoiceHistory.Type = InvoiceStatus.InvoiceReIssued; invoiceHistory.Description = ""; invoiceHistory.Invoice_Number = Convert.ToInt64(_classID); invoiceHistory.User_ID = CurrentUser.NameIdentifierInt64; invoiceHistory.Organization_ID = CurrentUser.CompanyID; invoiceHistory.Date_TIME = DateTime.Now; var x = _CustomerBAL.create_InvoiceHistoryBAL(invoiceHistory); ReportViewer ReportViewerRSFReports = new ReportViewer(); ReportViewerRSFReports.Height = Unit.Parse("100%"); ReportViewerRSFReports.Width = Unit.Parse("100%"); ReportViewerRSFReports.CssClass = "table"; var rptPath = Server.MapPath(@"../Report/INO_InvoiceRecipt.rdlc"); ReportViewerRSFReports.LocalReport.ReportPath = rptPath; long cID = Convert.ToInt64(CurrentUser.CompanyID); DataTable dt = _CustomerBAL.GetInvoiceReportsBAL(Convert.ToInt64(_classID), Convert.ToInt64(CurrentUser.CompanyID), bit); ReportViewerRSFReports.ProcessingMode = ProcessingMode.Local; ReportViewerRSFReports.LocalReport.DataSources.Clear(); ReportViewerRSFReports.LocalReport.EnableExternalImages = true; List <OrganizationModel> logoPath = _PersonBAL.GetOrganizationLogo(CurrentUser.CompanyID); ReportParameter paramLogo = new ReportParameter(); paramLogo.Name = "Picture"; string imagePath = new Uri(Server.MapPath(@"~/" + logoPath.FirstOrDefault().Logo)).AbsoluteUri; paramLogo.Values.Add(imagePath); ReportViewerRSFReports.LocalReport.SetParameters(paramLogo); ReportViewerRSFReports.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt)); ReportViewerRSFReports.LocalReport.Refresh(); byte[] mybytes = ReportViewerRSFReports.LocalReport.Render(format: "PDF", deviceInfo: ""); Session["InvoiceID"] = -1; Session["PrintDublicate"] = false; return(File(mybytes, System.Net.Mime.MediaTypeNames.Application.Octet, "Invoice.pdf")); } }
public ActionResult InvoiceDeposit_Create([DataSourceRequest] DataSourceRequest request, DepositDetail _DepositDetail, string PersonID) { if (ModelState.IsValid) { var json = new JavaScriptSerializer().Serialize(_DepositDetail); _UserBAL.LogInsert(DateTime.Now.ToString(), "10", Logs.Insert_Success.ToString(), System.Environment.MachineName, "User tried to create Courses at" + DateTime.UtcNow + " with user id =" + CurrentUser.NameIdentifierInt64, "", 0, this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), json.ToString(), CurrentUser.CompanyID); var data = _CustomerBAL.Read_InvoiceByIDBAL(PersonID); if (data.Invoice_Status == InvoiceStatus.InvoiceCancled) { ModelState.AddModelError(lr.InvoiceCancledOut, lr.InvoiceCancledOut); } else { InvoiceHistory invoiceHistory = new InvoiceHistory(); invoiceHistory.History_Name = "Invoice Deposit"; invoiceHistory.Type = InvoiceStatus.InvoiceDeposit; invoiceHistory.Description = ""; invoiceHistory.Invoice_Number = Convert.ToInt64(PersonID); invoiceHistory.User_ID = CurrentUser.NameIdentifierInt64; invoiceHistory.Organization_ID = CurrentUser.CompanyID; invoiceHistory.Date_TIME = DateTime.Now; _CustomerBAL.create_InvoiceHistoryBAL(invoiceHistory); _DepositDetail.Invoice_ID = PersonID; var x = this._CustomerBAL.InvoiceBalanceCheckBAL(_DepositDetail); var xx = this._CustomerBAL.InvoiceGrossTotalCheckBAL(_DepositDetail); double invoiceTotalPayment = Convert.ToDouble(x); double invoiceGrossTotal = Convert.ToDouble(xx); double balance = Math.Round(invoiceGrossTotal, 2) - Math.Round(invoiceTotalPayment, 2); balance = Math.Round(balance, 3); if (balance == 0) { ModelState.AddModelError(lr.BalanceZero, lr.BalanceZero); } else if (balance >= _DepositDetail.Payment) { _DepositDetail.Created_By = CurrentUser.NameIdentifierInt64; _DepositDetail.Created_Date = DateTime.Now; _DepositDetail.Organization_ID = CurrentUser.CompanyID; _DepositDetail.ID = this._CustomerBAL.InvoicePaymentDepositeCreateBAL(_DepositDetail); } else { ModelState.AddModelError(lr.BalanceMustBeEqual, lr.BalanceMustBeEqual); } } } var resultData = new[] { _DepositDetail }; return(Json(resultData.ToDataSourceResult(request, ModelState))); }
public void AddInvoiceHistory(InvoiceHistory invoiceHistory) { if (invoiceHistory == null) { throw new ArgumentNullException("Invoice History can not be null"); } context.Context.CreateInvoiceHistory( invoiceHistory.InvoiceId, invoiceHistory.InvoiceStatusId, invoiceHistory.AssociateId, invoiceHistory.LoggedInUser, invoiceHistory.Comments); }
public long create_InvoiceHistoryDAL(InvoiceHistory invoiceHistory) { var date = DateTime.Now.ToString("yyyy-MM-dd") + " " + CommonUtility.PersonFlagsClearingTime(); var parameters = new[] { ParamBuilder.Par("ID", 0) }; return(ExecuteInt64withOutPutparameterSp("INO_Create_Invoice_History", parameters, ParamBuilder.Par("@InvoiceID", invoiceHistory.Invoice_Number), ParamBuilder.Par("@Name", invoiceHistory.History_Name), ParamBuilder.Par("@type", invoiceHistory.Type), ParamBuilder.Par("@description", invoiceHistory.Description), ParamBuilder.Par("@UserBy", invoiceHistory.User_ID), ParamBuilder.Par("@Date", invoiceHistory.Date_TIME), ParamBuilder.Par("@OrganizationID", invoiceHistory.Organization_ID) )); }
public async Task <ActionResult <InvoiceHistoryDto> > Put([FromBody] InvoiceHistory invoiceHistory) { try { invoiceHistory.CreationDate = DateTime.UtcNow; await this.historyRepository.UpdateAsync(invoiceHistory); await this.historyRepository.SaveChangesAsync(); return(Ok(invoiceHistory)); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError)); } }
public override InvoiceModel MapResult(GetInvoiceResult serviceResult, HttpRequestMessage request) { InvoiceHistory invoiceHistory = serviceResult.InvoiceHistory; Currency currency = serviceResult.Currency; InvoiceModel invoiceModel = ObjectToObjectMapper.Map <InvoiceHistory, InvoiceModel>(invoiceHistory); invoiceModel.DiscountAmountDisplay = CurrencyFormatProvider.GetString(invoiceModel.DiscountAmount, currency); invoiceModel.CurrentBalanceDisplay = CurrencyFormatProvider.GetString(invoiceModel.CurrentBalance, currency); invoiceModel.InvoiceTotalDisplay = CurrencyFormatProvider.GetString(invoiceModel.InvoiceTotal, currency); invoiceModel.OtherChargesDisplay = CurrencyFormatProvider.GetString(invoiceModel.OtherCharges, currency); invoiceModel.ProductTotalDisplay = CurrencyFormatProvider.GetString(invoiceModel.ProductTotal, currency); invoiceModel.ShippingAndHandlingDisplay = CurrencyFormatProvider.GetString(invoiceModel.ShippingAndHandling, currency); invoiceModel.TaxAmountDisplay = CurrencyFormatProvider.GetString(invoiceModel.TaxAmount, currency); invoiceModel.ShipViaDescription = serviceResult.ShipViaDescription; invoiceModel.Properties = serviceResult.Properties; invoiceModel.Uri = request == null ? string.Empty : UrlHelper.Link("InvoiceV1", new { invoiceid = invoiceModel.InvoiceNumber }, request); HandlerBase.CopyCustomPropertiesToResult(invoiceHistory, invoiceModel, null); foreach (GetInvoiceLineResult invoiceLineResult in serviceResult.GetInvoiceLineResults) { InvoiceLineModel destination = new InvoiceLineModel(); if (invoiceLineResult.ProductDto != null) { ObjectToObjectMapper.Map(invoiceLineResult.ProductDto, destination); destination.ProductUri = invoiceLineResult.ProductDto.ProductDetailUrl; destination.Properties.Add("ProductID", invoiceLineResult.ProductDto.Id.ToString()); } ObjectToObjectMapper.Map(invoiceLineResult.InvoiceHistoryLine, destination); destination.UnitPriceDisplay = CurrencyFormatProvider.GetString(destination.UnitPrice, currency); destination.DiscountAmountDisplay = CurrencyFormatProvider.GetString(destination.DiscountAmount, currency); destination.LineTotalDisplay = CurrencyFormatProvider.GetString(destination.LineTotal, currency); HandlerBase.CopyCustomPropertiesToResult(invoiceLineResult.InvoiceHistoryLine, destination, null); invoiceModel.InvoiceLines.Add(destination); } foreach (InvoiceHistoryTaxDto invoiceHistoryTax in invoiceModel.InvoiceHistoryTaxes) { invoiceHistoryTax.TaxCode = TranslationLocalizer.TranslateLabel(invoiceHistoryTax.TaxCode); invoiceHistoryTax.TaxDescription = TranslationLocalizer.TranslateLabel(invoiceHistoryTax.TaxDescription); invoiceHistoryTax.TaxAmountDisplay = CurrencyFormatProvider.GetString(invoiceHistoryTax.TaxAmount, currency); } //invoiceModel.InvoiceDate = DateTime.SpecifyKind(invoiceModel.InvoiceDate, DateTimeKind.Unspecified) removed in 4.4; return(invoiceModel); }
private void ShowInvoiceHistory(InvoiceHistory invoiceHistory, Price.ShowFormat priceFormat) { dataGridView.Rows.Clear(); if (invoiceHistory == null) { return; } foreach (InvoiceShared invoice in invoiceHistory.Invoices) { FeeConfig feeConfig = invoiceHistory.FeeConfigHistory.GetFeeConfigHistoryForPeriod(invoice).FirstOrDefault(); invoice.SetFeeConfig(feeConfig); ShowSharedInvoice(invoice, priceFormat); } dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); }
public IActionResult ChangeStatusOfInvoice(int Id, int?page) { InvoiceHistory IH = _InvoiceService.GetInvoiceByID(Id); if (IH.Status.ToLower() == "due") { IH.Status = "Paid"; } else if (IH.Status.ToLower() == "paid") { IH.Status = "Due"; } else { ; } var dataUpdate = _InvoiceService.UpdateInvoice(IH); TempData["Error"] = "Status Changed Successfully."; return(RedirectToAction("InvoiceHistoryList", new { page = page })); }
public ActionResult Invoice_Create([DataSourceRequest] DataSourceRequest request, InvocieAndDetail _invoice) { if (ModelState.IsValid) { var json = new JavaScriptSerializer().Serialize(_invoice); _UserBAL.LogInsert(DateTime.Now.ToString(), "10", Logs.Insert_Success.ToString(), System.Environment.MachineName, "User tried to insert Invoice " + DateTime.UtcNow, "", 0, "Invoice", "Invoice_Create", json.ToString(), CurrentUser.CompanyID); _invoice.invoice.Generated_By = CurrentUser.NameIdentifierInt64; _invoice.invoice.Generated_Date = DateTime.UtcNow; _invoice.invoice.Invoice_Status = InvoiceStatus.InvoiceInvented; _invoice.invoice.Organization_ID = CurrentUser.CompanyID; _invoice.invoice.ID = _CustomerBAL.create_InvoiceBAL(_invoice.invoice); InvoiceHistory invoiceHistory = new InvoiceHistory(); invoiceHistory.History_Name = "Invoice Create"; invoiceHistory.Type = InvoiceStatus.InvoiceInvented; invoiceHistory.Description = ""; invoiceHistory.Invoice_Number = _invoice.invoice.ID; invoiceHistory.User_ID = CurrentUser.NameIdentifierInt64; invoiceHistory.Organization_ID = CurrentUser.CompanyID; invoiceHistory.Date_TIME = DateTime.Now; var x = _CustomerBAL.create_InvoiceHistoryBAL(invoiceHistory); foreach (var item in _invoice.invoiceDetails) { var jsons = new JavaScriptSerializer().Serialize(_invoice); _UserBAL.LogInsert(DateTime.Now.ToString(), "10", Logs.Insert_Success.ToString(), System.Environment.MachineName, "User tried to insert Invoice Detail at" + DateTime.UtcNow, "", 0, "Invoice", "InvoiceDetail_Create", jsons.ToString(), CurrentUser.CompanyID); item.Invoice_ID = _invoice.invoice.ID; _CustomerBAL.create_InvoiceDetailBAL(item); } var InvoiceIDd = _invoice.invoice.ID; var resultData2 = new[] { InvoiceIDd }; return(Json(new { success = true, responseText = InvoiceIDd }, JsonRequestBehavior.AllowGet)); } var InvoiceID = _invoice.invoice.ID; var resultData = new[] { _invoice }; return(Json(new { success = false, responseText = _invoice }, JsonRequestBehavior.AllowGet)); //return Json(resultData.ToDataSourceResult(request, ModelState)); }
public ActionResult InvoiceStatusChanges_Create(InvoiceStatusModel _objTask, string PersonID) { InvoiceHistory invoiceHistory = new InvoiceHistory(); invoiceHistory.History_Name = "Invoice Status Change"; invoiceHistory.Type = InvoiceStatus.InvoiceReIssued; invoiceHistory.Description = ""; invoiceHistory.Invoice_Number = Convert.ToInt64(PersonID); invoiceHistory.User_ID = CurrentUser.NameIdentifierInt64; invoiceHistory.Organization_ID = CurrentUser.CompanyID; invoiceHistory.Date_TIME = DateTime.Now; _CustomerBAL.create_InvoiceHistoryBAL(invoiceHistory); _objTask.Status_Name = _objTask.Type.ToString(); _objTask.Description = _objTask.Type.ToString(); _objTask.CreatedBy = CurrentUser.NameIdentifierInt64; _objTask.CreatedDate = DateTime.Now; _objTask.Invoice_ID = Convert.ToInt64(PersonID); _objTask.Organization_ID = CurrentUser.CompanyID; var data = _CustomerBAL.Read_InvoiceByIDBAL(PersonID); if (data.Invoice_Status == InvoiceStatus.InvoiceCancled || data.Invoice_Status == InvoiceStatus.InvoiceCashPartialyRecived || data.Invoice_Status == InvoiceStatus.InvoiceCashRecived || data.Invoice_Status == InvoiceStatus.InvoiceDeposit) { ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError); } else { var result = this._CustomerBAL.InvoiceStatusChangeCreateBAL(_objTask); if (result == -1) { ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError); } } var resultData = new[] { _objTask }; return(RedirectToAction("InvoiceGrid")); }
public ActionResult InvoiceHistoryCreate([DataSourceRequest] DataSourceRequest request, InvoiceHistory _objTask, string PersonID) { _objTask.Invoice_Number = Convert.ToInt64(PersonID); _objTask.User_ID = CurrentUser.NameIdentifierInt64; _objTask.Organization_ID = CurrentUser.CompanyID; _objTask.Date_TIME = DateTime.Now; var result = _CustomerBAL.create_InvoiceHistoryBAL(_objTask); if (result == -1) { ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError); } var resultData = new[] { _objTask }; return(Json(resultData.ToDataSourceResult(request, ModelState))); }
public long create_InvoiceHistoryBAL(InvoiceHistory invoiceHistory) { return(DAL.create_InvoiceHistoryDAL(invoiceHistory)); }
/// <summary> /// /// </summary> /// <param name="invoiceHistory"></param> public ConsumptionCalculator(InvoiceHistory invoiceHistory) { Contract.Requires(invoiceHistory != null); this.invoiceHistory = invoiceHistory; }