private List <CustomerInvoicePayment> GetSalesInvoicePaymentMethods(CustomerInvoice pInvoiceHeader) { List <CustomerInvoicePayment> lista = new List <CustomerInvoicePayment>(); try { bdContext.ComandText = "stp_SAFT_SALES_INVOICES_PAYMENTS"; bdContext.AddParameter("@INVOICE_ID", pInvoiceHeader.InvoiceID); MySqlDataReader dr = bdContext.ExecuteReader(); while (dr.Read()) { lista.Add(new CustomerInvoicePayment { PaymentMechanism = dr[0].ToString(), PaymentAmount = dr[1].ToString().Replace(",", ".").Replace("-", string.Empty), PaymentDate = DateTime.Parse(dr[2].ToString()).ToString("yyyy-MM-dd") });; } } catch (Exception ex) { } finally { bdContext.FecharConexao(); } return(lista); }
public void Example() { #region Usage string json = @"{ 'HourlyRate': 150, 'Hours': 40, 'TaxRate': 0.125 }"; CustomerInvoice invoice = JsonConvert.DeserializeObject <CustomerInvoice>(json); // increase tax to 15% invoice.TaxRate = 0.15m; string result = JsonConvert.SerializeObject(invoice); // { // "TaxRate": 0.15, // "HourlyRate": 150, // "Hours": 40 // } #endregion Assert.AreEqual(@"{""TaxRate"":0.15,""HourlyRate"":150,""Hours"":40}", result); }
public CustomerInvoicesSummaryForMobile GetCustomerInvoicesByDateWise(CustomerInvoice CusmObj) { CustomerInvoicesSummaryForMobile cusumObj = new CustomerInvoicesSummaryForMobile(); cusumObj.CustInvSumObj = new InvoiceSummaryformobile(); try { decimal tmp = 0; cusumObj.CustInv = _customerInvoicesRepository.GetCustomerInvoicesByDateWise(CusmObj); if (cusumObj.CustInv == null) { cusumObj.CustInvSumObj.Amount = 0; cusumObj.CustInvSumObj.AmountFormatted = "0"; cusumObj.CustInvSumObj.count = 0; } else { foreach (CustomerInvoice CIObj in cusumObj.CustInv) { tmp = tmp + CIObj.BalanceDue; } cusumObj.CustInvSumObj.Amount = tmp; cusumObj.CustInvSumObj.AmountFormatted = _commonBusiness.ConvertCurrency(tmp, 0); cusumObj.CustInvSumObj.count = cusumObj.CustInv.Count; } } catch (Exception) { throw; } return(cusumObj); }
public static void generateInvoice() { int idx = idxH_Trans; H_Trans_ItemModel hti = new H_Trans_ItemModel(); DataRow row = hti.Table.Select($"ID ='{list_htrans[idx].ID}'").FirstOrDefault(); if (row["STATUS"].ToString() == "P") { CustomerInvoice customerInvoice = new CustomerInvoice(); ReportView rv = new ReportView(customerInvoice); rv.setParam("kodeH_Trans", row["KODE"].ToString()); if (row["ID_PROMO"].ToString() == "") { rv.setParam("kodePromo", "-"); } else { PromoModel pm = new PromoModel(); DataRow rowPromo = pm.Table.Select($"ID = '{row["ID_PROMO"]}'").First(); rv.setParam("kodePromo", rowPromo["KODE"].ToString()); } string path = (ImageHelper.getDebugPath() + "\\Resource\\Items\\"); rv.setParam("imagePath", path); rv.ShowDialog(); } else { MessageBox.Show("Transaksi yang belum dibayar!"); } }
public void ClearForm() { try { m_si = new CustomerInvoice(); textBoxCode.Text = ""; dateKryptonDateTimePicker.Value = DateTime.Today; employeeKryptonComboBox.SelectedIndex = 0; currencyKryptonComboBox.SelectedIndex = 0; nettotalAmountkryptonNumericUpDown.Value = 0m; notesKryptonTextBox.Text = ""; divisionKryptonComboBox.SelectedIndex = 0; termofpaymentKryptonComboBox.SelectedIndex = 0; duedateKryptonDateTimePicker.Value = DateTime.Today; subTotalKryptonNumericUpDown.Value = 0m; discPercentKryptonNumericUpDown.Value = 0m; discAmountkryptonNumericUpDown.Value = 0m; discAfterAmountKryptonNumericUpDown.Value = 0m; taxKryptonComboBox.SelectedIndex = 0; taxAfterAmountkryptonNumericUpDown.Value = 0m; otherExpensekryptonNumericUpDown.Value = 0m; supplierkryptonComboBox.SelectedIndex = 0; docnokryptonTextBox.Text = ""; docdatekryptonDateTimePicker.Value = DateTime.Today; itemsDataGrid.Rows.Clear(); errorProvider1.Clear(); } catch (Exception x) { KryptonMessageBox.Show(x.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public Invoice CreateNewInvoice(CustomerInvoice cinvoice) { try { if (cinvoice == null) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Invoice cannot be null")); } var serviceContext = QbApiHelper.GetServiceContext(); var service = new DataService(serviceContext); var invoice = MapCustomerInvoiceToInvoice(cinvoice); var returnedInvoice = service.Add <Invoice>(invoice); return(returnedInvoice); } catch (Exception e) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "An error ocurred while creating a new Invoice: " + e.Message)); } }
public CustomerInvoiceViewModel GetCustomerHoursAndAmount(int customerId, string type, string beginDate, string endDate, int inoviceId) { CustomerInvoiceViewModel objectCustomerInvoiceViewModel = new CustomerInvoiceViewModel(); using (SecurityAgencyEntities objContext = new SecurityAgencyEntities()) { if (string.IsNullOrEmpty(type)) { //Get beginDate and endDate first CustomerInvoice objectCustomerInvoice = _repository.GetAll <CustomerInvoice>().Where(x => x.CustomerId == customerId && x.IsDeleted == false && x.InvoiceId != inoviceId).OrderByDescending(i => i.EndDate).FirstOrDefault(); if (objectCustomerInvoice != null) { beginDate = objectCustomerInvoice.EndDate.AddDays(1).ToString(); endDate = objectCustomerInvoice.EndDate.AddDays(7).ToString(); } } //////Get values from hourlog table List <getCustomerInvoiceAmount_Result> objectgetCustomerInvoiceAmount_Result = objContext.getCustomerInvoiceAmount(Convert.ToDateTime(beginDate), Convert.ToDateTime(endDate), customerId).ToList(); objectCustomerInvoiceViewModel.TotalHours = Convert.ToInt32(objectgetCustomerInvoiceAmount_Result.Sum(i => i.TotHours)); objectCustomerInvoiceViewModel.Amount = Convert.ToInt32(objectgetCustomerInvoiceAmount_Result.Sum(i => i.Amount)); objectCustomerInvoiceViewModel.BeginDate = Convert.ToDateTime(beginDate); objectCustomerInvoiceViewModel.EndDate = Convert.ToDateTime(endDate); objectCustomerInvoiceViewModel.HourlyRate = Convert.ToDecimal(objectgetCustomerInvoiceAmount_Result.FirstOrDefault().HourlyRate); return(objectCustomerInvoiceViewModel); } }
public CustomerInvoice Create(CustomerInvoice customerInvoice) { using var dbContextTransaction = _context.Database.BeginTransaction(); foreach (var concept in customerInvoice.Concepts) { var stock = _context.StockHistories .OrderByDescending(history => history.Created) .FirstOrDefault(history => history.ProductId == concept.ProductId); _context.Add(new StockHistory() { Created = DateTime.Now, Quantity = Convert.ToInt16(-concept.Quantity), Type = "OUT", ProductId = concept.ProductId, TotalQuantity = Convert.ToInt16((stock?.TotalQuantity ?? 0) - concept.Quantity), UnitPrice = concept.UnitPrice, Total = concept.Total }); } customerInvoice.Created = DateTime.Now; _context.Add(customerInvoice); _context.SaveChanges(); dbContextTransaction.Commit(); return(customerInvoice); }
private List <References> GetRetifiedInvoicesReferences(CustomerInvoice pInvoice) { List <References> referencesList = new List <References>(); try { bdContext.ComandText = "stp_SAFT_SALES_INVOICES_RETIFIED_DOCUMENTS_REFERENCES"; bdContext.AddParameter("@INVOICE_ID", pInvoice.InvoiceID); MySqlDataReader dr = bdContext.ExecuteReader(); while (dr.Read()) { referencesList.Add( new References { Reference = dr[0].ToString(), Reason = dr[1].ToString(), }); } } catch (Exception ex) { } finally { bdContext.FecharConexao(); } return(referencesList); }
public string Add(string sessionId, CustomerInvoice invoice) { //Real Object //var invoice = new CustomerInvoice // { // CustomerCode = "C004200", // DocumentDate = DateTime.Today, // DueDate = DateTime.Today.AddMonths(1), // PostingDate = new DateTime(2015, 11, 01), // SellerCode = 4, // DiscountPercent = 0, // DocumentType = "Alquileres", // ItemDetails = new List<ItemDetail> // { // //new ItemDetail() {ItemCode = "abc001", Quantity = 1, TaxCode = "IV", Currency = "COL"}, // new ItemDetail() {ItemCode = "A9999999", Quantity = 2.5,TaxLiable = false, Currency = "USD", Price = 60 } // }, // Comments = "Migrado desde Pithos" // }; var addObject = new AddObject { CommandID = "Add invoice", BOM = { BO = Mapper.Map <Bombo>(invoice) } }; addObject.BOM.BO.AdmInfo.Object = "oInvoices"; // Generate SOAP Message var command = SoapXmlSerializer.SoapXmlSerialize(addObject, sessionId); var result = SapServer.Execute(command); return(result.Body.Fault == null?result.Body.AddObjectResponse.RetKey.ToString(CultureInfo.InvariantCulture) : result.Body.Fault.Reason.Text.Value); }
public async Task <IActionResult> Edit(string id, [Bind("customerInvoiceId,invoiceNumber,invoiceDate,invoiceReference,dueDate,myCompanyId,customerId,noteToRecipient,termsAndCondition,subTotal,taxAmount,discount,shipping,grandTotal,isPaid,HasChild,createdAt")] CustomerInvoice customerInvoice) { if (id != customerInvoice.customerInvoiceId) { return(NotFound()); } if (ModelState.IsValid) { try { customerInvoice.grandTotal = customerInvoice.subTotal + customerInvoice.taxAmount - customerInvoice.discount + customerInvoice.shipping; _context.Update(customerInvoice); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerInvoiceExists(customerInvoice.customerInvoiceId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["customerId"] = new SelectList(_context.Customer, "customerId", "customerId", customerInvoice.customerId); ViewData["myCompanyId"] = new SelectList(_context.Set <MyCompany>(), "myCompanyId", "myCompanyId", customerInvoice.myCompanyId); return(View(customerInvoice)); }
/// <summary> /// Mapping between the Customer Invoice Entity and the Intuit Invoice Entity /// </summary> /// <returns></returns> private static Invoice MapCustomerInvoiceToInvoice(CustomerInvoice customerInvoice) { if (customerInvoice == null) { throw new ArgumentNullException("customerInvoice"); } var invoice = new Invoice(); var lines = customerInvoice.Line.Select(line => new Line { Amount = line.Amount, AmountSpecified = true, DetailTypeSpecified = true, DetailType = LineDetailTypeEnum.SalesItemLineDetail, Description = line.Description, AnyIntuitObject = new Intuit.Ipp.Data.SalesItemLineDetail { ItemElementName = ItemChoiceType.UnitPrice, AnyIntuitObject = line.Amount, ItemRef = new ReferenceType { Value = line.SalesItemLineDetail.ItemRef.Value, name = line.SalesItemLineDetail.ItemRef.Name, type = line.SalesItemLineDetail.ItemRef.Type } } }).ToList(); invoice.Line = lines.ToArray(); invoice.BillEmail = new EmailAddress { Address = customerInvoice.BillEmail, Default = true, DefaultSpecified = true }; invoice.TxnDate = DateTime.UtcNow; invoice.TxnDateSpecified = true; invoice.DueDate = DateTime.UtcNow.AddDays(30); invoice.DueDateSpecified = true; invoice.EmailStatusSpecified = true; invoice.EmailStatus = EmailStatusEnum.NeedToSend; invoice.CustomerRef = new ReferenceType { Value = customerInvoice.CustomerRef.Value, name = customerInvoice.CustomerRef.Name, type = customerInvoice.CustomerRef.Type }; return(invoice); }
public ActionResult DeleteConfirmed(int id) { CustomerInvoice customerInvoie = db.customerInvoice.Find(id); db.customerInvoice.Remove(customerInvoie); db.SaveChanges(); return(RedirectToAction("Index")); }
private void OKkryptonButton_Click(object sender, EventArgs e) { if (gridData.SelectedRows.Count > 0) { CUSTOMER_INVOICE = (CustomerInvoice)gridData.SelectedRows[0].Tag; this.Close(); } }
private void gridData_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (gridData.SelectedRows.Count > 0) { CUSTOMER_INVOICE = (CustomerInvoice)gridData.SelectedRows[0].Tag; this.Close(); } }
public CustomerInvoice SpecialPaymentSummary(Guid InvoiceID) { CustomerInvoice CI = new CustomerInvoice(); CI = _customerInvoicesRepository.SpecialPaymentSummary(InvoiceID); return(CI); }
private void LoadPendingCreditNotes() { var creditNotes = new List <CustomerInvoice>(); var headers = new List <SAP_CreditNoteMaster>(); var details = new List <SAP_CreditNoteDetail>(); logger.Info("Cargando Notas de Credito"); using (var renteco = new RentecoEntities()) { headers = renteco.SAP_CreditNoteMaster.ToList(); details = renteco.SAP_CreditNoteDetail.ToList(); } foreach (var header in headers) { var customerInvoice = new CustomerInvoice { SellerCode = header.SlpCode == null ? 0 : (int)header.SlpCode, DiscountPercent = header.DiscountPercent, DocumentId = (int)header.DocNum, InvoiceType = header.DocType, DocumentType = header.TipoDocumento, CustomerCode = header.CardCode, Comments = header.Comments, PostingDate = header.DocDate, // Fecha Contabilizacion DueDate = header.DocDate, // Fecha Vencimiento DocumentDate = header.TaxDate, // Fecha Documento DocCurrency = header.DocCurrency, NumAtCard = header.NumAtCard.ToString(CultureInfo.InvariantCulture), HandWritten = header.HandWritten == "tYES", ManualNumber = header.ManualNumber == "tYES" }; // Invoice Details var invoiceDetails = details.Where(x => x.RecordKey.Equals(header.DocNum)).ToList(); customerInvoice.ItemDetails = new List <ItemDetail>(); foreach (var invoiceDetail in invoiceDetails) { customerInvoice.ItemDetails.Add(new ItemDetail { TaxLiable = false, ItemCode = "A9999999", TaxCode = invoiceDetail.TaxCode, Currency = invoiceDetail.Currency, Quantity = 1, WarehouseCode = 16, Price = invoiceDetail.LineTotal == null ? 0 : Convert.ToDecimal(invoiceDetail.LineTotal.Value), DiscountPercent = invoiceDetail.DiscountPercent }); } creditNotes.Add(customerInvoice); } SavePendingCreditNotes(creditNotes); }
// GET: CustomerInvoice/Create public IActionResult Create() { ViewData["customerId"] = new SelectList(_context.Customer, "customerId", "customerName"); ViewData["myCompanyId"] = new SelectList(_context.Set <MyCompany>(), "myCompanyId", "companyName"); CustomerInvoice obj = new CustomerInvoice(); obj.invoiceDate = DateTime.UtcNow.Date; obj.dueDate = obj.invoiceDate.AddMonths(1).Date; return(View(obj)); }
public ActionResult Edit([Bind(Include = "InvoiceId,OrderId,Username,FullName,BusinessName,VatNumber,Address,Phone,Email,Total,OrderDate,DeliveryDate,Path")] CustomerInvoice customerInvoie) { if (ModelState.IsValid) { db.Entry(customerInvoie).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customerInvoie)); }
/// <summary> /// Format the correct invoice fields to the specification of the hash field. /// </summary> /// <param name="toHash">StringBuilder that will contain the formated string.</param> /// <param name="invoice">The invoice.</param> /// <param name="hashAnterior">The string hash generated of the last invoice.</param> void FormatinvoicesStringToHash(ref StringBuilder toHash, CustomerInvoice invoice, string hashAnterior) { toHash.Clear(); toHash.AppendFormat("{0};{1};{2};{3};{4}" , invoice.InvoiceDate , invoice.SystemEntryDate , invoice.InvoiceNo , invoice.DocumentTotals.GrossTotal , hashAnterior); }
public async Task <IActionResult> PostCustomerInvoiceLine([FromBody] CustomerInvoiceLine customerInvoiceLine) { Item item = await _context.Item.Include(x => x.tax).SingleOrDefaultAsync(x => x.itemId.Equals(customerInvoiceLine.itemId)); customerInvoiceLine.taxId = item.taxId; if (customerInvoiceLine.customerInvoiceLineId == string.Empty) { customerInvoiceLine.customerInvoiceLineId = Guid.NewGuid().ToString(); if (customerInvoiceLine.price.Equals(0m)) { customerInvoiceLine.price = item.price; } customerInvoiceLine.amount = (decimal)customerInvoiceLine.quantity * customerInvoiceLine.price; customerInvoiceLine.taxAmount = (decimal)(item.tax.taxRate / 100.0) * customerInvoiceLine.amount; customerInvoiceLine.totalAmount = customerInvoiceLine.amount + customerInvoiceLine.taxAmount; _context.CustomerInvoiceLine.Add(customerInvoiceLine); CustomerInvoice ci = await _context.CustomerInvoice.Include(x => x.customerInvoiceLine).SingleOrDefaultAsync(x => x.customerInvoiceId.Equals(customerInvoiceLine.customerInvoiceId)); ci.subTotal = ci.customerInvoiceLine.Sum(x => x.amount); ci.taxAmount = ci.customerInvoiceLine.Sum(x => x.taxAmount); ci.grandTotal = ci.subTotal + ci.taxAmount - ci.discount + ci.shipping; _context.CustomerInvoice.Update(ci); await _context.SaveChangesAsync(); return(Json(new { success = true, message = "Add new data success." })); } else { if (customerInvoiceLine.price.Equals(0m)) { customerInvoiceLine.price = item.price; } customerInvoiceLine.amount = (decimal)customerInvoiceLine.quantity * customerInvoiceLine.price; customerInvoiceLine.taxAmount = (decimal)(item.tax.taxRate / 100.0) * customerInvoiceLine.amount; customerInvoiceLine.totalAmount = customerInvoiceLine.amount + customerInvoiceLine.taxAmount; _context.Update(customerInvoiceLine); CustomerInvoice ci = await _context.CustomerInvoice.Include(x => x.customerInvoiceLine).SingleOrDefaultAsync(x => x.customerInvoiceId.Equals(customerInvoiceLine.customerInvoiceId)); ci.subTotal = ci.customerInvoiceLine.Sum(x => x.amount); ci.taxAmount = ci.customerInvoiceLine.Sum(x => x.taxAmount); ci.grandTotal = ci.subTotal + ci.taxAmount - ci.discount + ci.shipping; _context.CustomerInvoice.Update(ci); await _context.SaveChangesAsync(); return(Json(new { success = true, message = "Edit data success." })); } }
public CustomerInvoice InsertUpdateInvoice(CustomerInvoice _customerInvoicesObj, AppUA ua) { if (_customerInvoicesObj.ID != null && _customerInvoicesObj.ID != Guid.Empty) { return(_customerInvoicesRepository.UpdateInvoice(_customerInvoicesObj, ua)); } else { return(_customerInvoicesRepository.InsertInvoice(_customerInvoicesObj, ua)); } }
public async Task <IActionResult> PrintInvoice(string id) { CustomerInvoice obj = await _context.CustomerInvoice .Where(x => x.customerInvoiceId.Equals(id)) .Include(x => x.customerInvoiceLine) .ThenInclude(c => c.item) .Include(x => x.customer) .Include(x => x.myCompany).FirstOrDefaultAsync(); return(View(obj)); }
public int GetNewInvoiceNumber() { CustomerInvoice customerInvoice = _repository.GetAll <CustomerInvoice>().OrderByDescending(i => i.InvoiceNo).FirstOrDefault(); if (customerInvoice == null) { return(1001); } return(customerInvoice.InvoiceNo + 1); }
public CustomerInvoice InsertUpdateSpecialPayments(CustomerInvoice _customerInvoicesObj, AppUA ua) { if (_customerInvoicesObj.SpecialPayObj.ID != null && _customerInvoicesObj.SpecialPayObj.ID != Guid.Empty) { return(_customerInvoicesRepository.UpdateSpecialPayments(_customerInvoicesObj, ua)); } else { return(_customerInvoicesRepository.InsertSpecialPayments(_customerInvoicesObj, ua)); } }
public string GetOpenInvoicesForMobile(CustomerInvoice CusObj) { try { CustomerInvoicesSummaryForMobileViewModel invoiceObj = Mapper.Map <CustomerInvoicesSummaryForMobile, CustomerInvoicesSummaryForMobileViewModel>(_customerInvoicesBusiness.GetOpeningCustomerInvoices(CusObj)); return(JsonConvert.SerializeObject(new { Result = true, Records = new { OpeningList = invoiceObj.CustInv, Summary = invoiceObj.CustInvSumObj } })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { Result = false, Message = ex.Message })); } }
public CustomerInvoiceViewModel GetCustomerInvoice(int id) { CustomerInvoice customerInvoice = _repository.Find <CustomerInvoice>(x => x.InvoiceId == id); if (customerInvoice == null) { return(null); } Mapper.CreateMap <CustomerInvoice, CustomerInvoiceViewModel>(); return(Mapper.Map <CustomerInvoice, CustomerInvoiceViewModel>(customerInvoice)); }
public int DeleteCustomerInvoice(int Id, int UserId) { CustomerInvoice customerInvoice = _repository.Find <CustomerInvoice>(x => x.InvoiceId == Id); if (customerInvoice == null) { return(0); } customerInvoice.IsDeleted = true; customerInvoice.DeletedBy = UserId; customerInvoice.DeletedDate = DateTime.Now; return(_repository.Modify <CustomerInvoice>(customerInvoice)); }
public async Task <IActionResult> Create([Bind("customerInvoiceId,invoiceNumber,invoiceDate,invoiceReference,dueDate,myCompanyId,customerId,noteToRecipient,termsAndCondition,subTotal,taxAmount,discount,shipping,grandTotal,isPaid,HasChild,createdAt")] CustomerInvoice customerInvoice) { if (ModelState.IsValid) { _context.Add(customerInvoice); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["customerId"] = new SelectList(_context.Customer, "customerId", "customerId", customerInvoice.customerId); ViewData["myCompanyId"] = new SelectList(_context.Set <MyCompany>(), "myCompanyId", "myCompanyId", customerInvoice.myCompanyId); return(View(customerInvoice)); }
// GET: CustomerInvoies/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerInvoice customerInvoie = db.customerInvoice.Find(id); if (customerInvoie == null) { return(HttpNotFound()); } return(View(customerInvoie)); }