Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ArticleId,Quantity,ArticlePrice,RowTotal")] InvoiceRow invoiceRow)
        {
            if (id != invoiceRow.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var applicationDbContext = _context.InvoiceRow
                                               .Include(i => i.Article);
                    invoiceRow.RowTotal = invoiceRow.Quantity * invoiceRow.ArticlePrice;

                    _context.Update(invoiceRow);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InvoiceRowExists(invoiceRow.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArticleId"] = new SelectList(_context.Article, "Id", "Id", invoiceRow.ArticleId);
            return(View(invoiceRow));
        }
Beispiel #2
0
        public static void ValidateInvoice(Invoice source, Invoice repository)
        {
            Assert.IsNotNull(repository);
            Assert.AreEqual(source.Id, repository.Id);
            Assert.AreEqual(source.InvoiceName, repository.InvoiceName);

            //TODO Dont forget to fix this
            //Assert.AreEqual(source.Date, repository.Date);


            Assert.AreEqual(source.InvoiceRows.Count, repository.InvoiceRows.Count);

            foreach (InvoiceRow row in source.InvoiceRows)
            {
                InvoiceRow invoiceRow = repository.InvoiceRows.Find(rRow => rRow.Id == row.Id);

                Assert.IsNotNull(invoiceRow);
                Assert.AreEqual(row.Sum, invoiceRow.Sum);
                Assert.AreEqual(row.Comments, invoiceRow.Comments);

                //Person
                //Assert.IsNotNull(invoiceRow.PersonEntity);
                //Assert.AreEqual(row.PersonEntity.Id, invoiceRow.PersonEntity.Id);
                //Assert.AreEqual(row.PersonEntity.Name, invoiceRow.PersonEntity.Name);

                ////Company
                //Assert.IsNotNull(invoiceRow.CompanyEntity);
                //Assert.AreEqual(row.CompanyEntity.Id, invoiceRow.CompanyEntity.Id);
                //Assert.AreEqual(row.CompanyEntity.CompanyName, invoiceRow.CompanyEntity.CompanyName);
            }
        }
Beispiel #3
0
        private static InvoiceRow ReadLineItemRow(string lineReading)
        {
            //row create
            var row = new InvoiceRow();

            // row.RowId = ++rowIndex;

            //row.Kopnota = Encoding.ASCII.GetString(rowBytes, 32, 8).Trim(); ; //32,8
            row.Kopnota    = GetField(lineReading, 32, 8).Trim();
            row.Dag        = GetField(lineReading, 41, 4).Trim();
            row.Tid        = GetField(lineReading, 46, 5).Trim();  //46,5
            row.ForsStalle = GetField(lineReading, 52, 17).Trim();
            row.Kundref    = GetField(lineReading, 69, 9).Trim();  //69,9
            row.Artikel    = GetField(lineReading, 80, 10).Trim(); //80,10
            row.Kvant      = GetField(lineReading, 93, 5).Trim();  //93,5
            row.Apris      = GetField(lineReading, 101, 6).Trim(); //101,6
            row.Brutto     = GetField(lineReading, 109, 7).Trim(); //109,7
            row.Rabatt     = GetField(lineReading, 117, 7).Trim(); //117,7
            row.Moms       = GetField(lineReading, 127, 6).Trim(); //127,6
            row.Netto      = GetField(lineReading, 133, 9).Trim(); //135,9


            //end-row Create

            return(row);
        }
Beispiel #4
0
        public async Task <ActionResult <InvoiceRow> > PostInvoiceRow(InvoiceRow invoiceRow)
        {
            _context.InvoiceRow.Add(invoiceRow);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetInvoiceRow", new { id = invoiceRow.Id }, invoiceRow));
        }
 public InvoiceRow UpdateInvoiceRow(InvoiceRow invoiceRow)
 {
     invoiceRow.Name     = Name;
     invoiceRow.Quantity = Quantity;
     invoiceRow.Amount   = Amount;
     return(invoiceRow);
 }
        public IEnumerable <InvoiceRow> Post([FromBody] IEnumerable <InvoiceRow> pList)
        {
            int j = pList.Count();

            j = j - 1;
            var id = pList.Last();

            pList = pList.Take(pList.Count() - 1);
            foreach (InvoiceRow model in pList)
            {
                InvoiceRow e = new InvoiceRow();

                e.invoicedetail_id = model.invoicedetail_id;
                e.invoice_id       = id.invoice_id;
                e.Quantity         = model.Quantity;
                e.unit             = model.unit;
                e.Amount           = model.Amount;
                e.Desc             = model.Desc;
                e.product          = model.product;



                context.AddInvoiceDetail(e);
            }
            return(pList);
        }
Beispiel #7
0
        public IActionResult Index(InvoiceRow invoiceRow)
        {
            var applicationDbContext = _context.InvoiceRow
                                       .Include(i => i.Article);

            invoiceRow.RowTotal = invoiceRow.Quantity * invoiceRow.ArticlePrice;
            return(View(invoiceRow));
        }
 public static InvoiceRowDto FromInvoiceRow(InvoiceRow invoiceRow)
 {
     return(new InvoiceRowDto()
     {
         Id = invoiceRow.Id,
         Name = invoiceRow.Name,
         Quantity = invoiceRow.Quantity,
         Amount = invoiceRow.Amount,
     });
 }
Beispiel #9
0
        private void Row_ViewButtonClicked(InvoiceRow sender)
        {
            FrmDetail frm = new FrmDetail
            {
                Invoice = sender.Invoice
            };

            frm.ShowDialog();
            RefreshView();
        }
        private InvoiceRow PrepareInvoiceRowWithEquipment(InventoryType type, int rentedDays)
        {
            var row = new InvoiceRow();

            row.Equipment = new Equipment
            {
                Type = type
            };
            row.RentedDays = rentedDays;
            return(row);
        }
Beispiel #11
0
        private static InvoiceRow GetInvoiceRow(CartRowDto cartRow, Invoice invoice)
        {
            var invoiceRow = new InvoiceRow();

            invoiceRow.Invoice     = invoice;
            invoiceRow.StartDate   = DateTime.Now;
            invoiceRow.EndDate     = invoiceRow.StartDate.AddDays(cartRow.DaysRented);
            invoiceRow.EquipmentId = cartRow.EquipmentId;

            return(invoiceRow);
        }
            public InvoiceRow AddInvoiceRow(
                string Address,
                System.Decimal AmountDue,
                System.Decimal AmountPaid,
                string AmpherName,
                System.DateTime ArrivalDate,
                System.Double CRate,
                int CustomerID,
                string CustomerName,
                string Description,
                System.Double DRate,
                System.Decimal DriverCommision,
                string DriverName,
                System.Decimal Insurance,
                System.Double LRate,
                string PaymentType,
                System.Decimal Price,
                int ProductID,
                string ProductName,
                string ProvinceName,
                System.DateTime ShippingDate,
                System.Decimal TotalCost,
                int Weight)
            {
                InvoiceRow rowInvoiceRow = ((InvoiceRow)(this.NewRow()));

                rowInvoiceRow.ItemArray = new object[] {
                    Address,
                    AmountDue,
                    AmountPaid,
                    AmpherName,
                    ArrivalDate,
                    CRate,
                    CustomerID,
                    CustomerName,
                    Description,
                    DRate,
                    DriverCommision,
                    DriverName,
                    Insurance,
                    null,
                    LRate,
                    PaymentType,
                    Price,
                    ProductID,
                    ProductName,
                    ProvinceName,
                    ShippingDate,
                    TotalCost,
                    Weight
                };
                this.Rows.Add(rowInvoiceRow);
                return(rowInvoiceRow);
            }
 public new void AddInvoiceRow(InvoiceRow row)
 {
     if (DoesCustomerHaveCredit())
     {
         base.AddInvoiceRow(row);
     }
     else
     {
         throw new Exception("Customer Invoice cannot be created, no credit available");
     }
 }
Beispiel #14
0
 public InvoiceRow AddInvoiceDetail(InvoiceRow e)
 {
     try
     {
         InvoiceRows.Add(e);
         int id = this.SaveChanges();
     }
     catch (Exception ex)
     {
     }
     return(e);
 }
 public InvoiceRowDTO Transform(InvoiceRow ir)
 {
     if (ir == null)
     {
         return(null);
     }
     return(new InvoiceRowDTO
     {
         InvoiceRowId = ir.InvoiceRowId,
         Price = ir.Price,
         RowTax = ir.RowTax,
         TicketId = ir.TicketId
     });
 }
            public InvoiceRow AddInvoiceRow(string CustomerName, string PaymentType, System.Decimal TotalCost, System.Decimal AmountPaid, System.Decimal AmountDue)
            {
                InvoiceRow rowInvoiceRow = ((InvoiceRow)(this.NewRow()));

                rowInvoiceRow.ItemArray = new object[] {
                    null,
                    CustomerName,
                    PaymentType,
                    TotalCost,
                    AmountPaid,
                    AmountDue
                };
                this.Rows.Add(rowInvoiceRow);
                return(rowInvoiceRow);
            }
            public InvoiceRow AddInvoiceRow(System.Guid InvoiceID, System.DateTime InvoiceDate, string Terms, string FOB, string PO, CustomerRow parentCustomerRowByCustomerInvoice)
            {
                InvoiceRow rowInvoiceRow = ((InvoiceRow)(this.NewRow()));

                rowInvoiceRow.ItemArray = new object[] {
                    InvoiceID,
                    null,
                    InvoiceDate,
                    Terms,
                    FOB,
                    PO,
                    parentCustomerRowByCustomerInvoice[0]
                };
                this.Rows.Add(rowInvoiceRow);
                return(rowInvoiceRow);
            }
Beispiel #18
0
        public async Task <IActionResult> Create([Bind("Id,ArticleId,Quantity,ArticlePrice,RowTotal")] InvoiceRow invoiceRow)
        {
            if (ModelState.IsValid)
            {
                var applicationDbContext = _context.InvoiceRow
                                           .Include(i => i.Article);
                invoiceRow.RowTotal = invoiceRow.Quantity * invoiceRow.ArticlePrice;

                _context.Add(invoiceRow);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArticleId"] = new SelectList(_context.Article, "Id", "Id", invoiceRow.ArticleId);
            return(View(invoiceRow));
        }
Beispiel #19
0
        private void RefreshViewViaUserControl()
        {
            pnlItems.Controls.Clear();

            visibleInvoices = GetOrderedAndFilteredInvoices();

            foreach (var invoice in visibleInvoices)
            {
                InvoiceRow row = new InvoiceRow()
                {
                    Invoice = invoice,
                };
                row.ViewButtonClicked += Row_ViewButtonClicked;
                row.Width              = pnlItems.Width - VERTICAL_SCROLLBAR_PLACEHOLDER_WIDTH;
                row.BorderStyle        = BorderStyle.FixedSingle;
                if (chkColorize.Checked)
                {
                    row.BackColor = GetBackColorForInvoice(invoice);
                }
                pnlItems.Controls.Add(row);
            }
        }
Beispiel #20
0
        private UserControl InitInvoiceRow(ref string TagControl, ref string Title, params object[] list)
        {
            UserControl usControl;

            if ((list[0] as MDataSet.InvoiceMasterRow) != null)
            {
                TagControl += (list[0] as MDataSet.InvoiceMasterRow).ID.ToString();
                if (!FindOpenedTabs(TagControl))
                {
                    Title     = "№" + (list[0] as MDataSet.InvoiceMasterRow).Number.ToString() + " " + (list[0] as MDataSet.InvoiceMasterRow).TradePupletName.ToString();
                    usControl = new InvoiceRow((list[0] as MDataSet.InvoiceMasterRow));
                    (usControl as InvoiceRow).Tag  = Title;
                    (usControl as InvoiceRow).Dock = DockStyle.Fill;
                }
                else
                {
                    return(null);
                }
                return(usControl);
            }

            return(null);
        }
 public void RemoveInvoiceRow(InvoiceRow row)
 {
     this.Rows.Remove(row);
 }
 public void AddInvoiceRow(InvoiceRow row)
 {
     this.Rows.Add(row);
 }
 public InvoiceRowChangeEvent(InvoiceRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
Beispiel #24
0
 public InvoiceRowChangeEvent(InvoiceRow row, global::System.Data.DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
 private InvoiceRow PrepareInvoiceRowWithEquipment(InventoryType type, int rentedDays)
 {
     var row = new InvoiceRow();
     row.Equipment = new Equipment
     {
         Type = type
     };
     row.RentedDays = rentedDays;
     return row;
 }