示例#1
0
        public void InsertNewDetailInvoice()
        {
            InvoiceManager manager = new InvoiceManager();
            //id =>1007 because 1006 is the first test method and fail.
            long    id      = 1007;
            Invoice invoice = new Invoice()
            {
                Id   = id,
                Type = Invoice.Types.A.ToString()
            };

            invoice.AddDetail(new InvoiceDetail()
            {
                Id          = id,
                InvoiceId   = id,
                Description = "Venta insumos varios",
                Amount      = 14,
                UnitPrice   = 4.33
            });

            invoice.AddDetail(new InvoiceDetail()
            {
                Id = id,
                //Same FK
                InvoiceId   = id,
                Description = "Venta insumos tóner",
                Amount      = 5,
                UnitPrice   = 87
            });

            manager.Insert(invoice);
            Invoice result = manager.GetById(id);

            Assert.AreEqual(invoice, result);
        }
示例#2
0
        public void InsertNewDetailInvoice()
        {
            InvoiceManager manager = new InvoiceManager();
            long           id      = 1007;
            Invoice        invoice = new Invoice()
            {
                Id   = id,
                Type = Invoice.Types.A.ToString()
            };

            invoice.AddDetail(new InvoiceDetail()
            {
                Id          = id,
                InvoiceId   = id,
                Description = "Venta insumos varios",
                Amount      = 14,
                UnitPrice   = 4.33
            });

            invoice.AddDetail(new InvoiceDetail()
            {
                Id          = id,
                InvoiceId   = 6,
                Description = "Venta insumos tóner",
                Amount      = 5,
                UnitPrice   = 87
            });

            manager.Insert(invoice);
            Invoice result = manager.GetById(id);

            Assert.AreEqual(invoice, result);
        }
示例#3
0
        /// <summary>
        /// Arik Chadima
        /// Created: 2015/4/16 Binds the hosted report viewer to the PrintableInvoice with the given
        ///          guest with the guestID.
        /// </summary>
        /// <param name="guestId">guest id of the guest to use for the invoice</param>
        /// <returns>bool successful</returns>
        /// <remarks>Updated by Arik Chadima 2015/4/17</remarks>
        /// <exception cref="WanderingTurtleException" />
        public void BuildInvoice(int guestId)
        {
            //builds the managers required
            InvoiceManager    invoiceManager = new InvoiceManager();
            HotelGuestManager guestManager   = new HotelGuestManager();

            try
            {
                RvHostArea.LocalReport.DataSources.Clear();
                ReportDataSource reportDataSource1 = new ReportDataSource
                {
                    Name = "HotelGuestDataset"
                };
                //Name of the report dataset in our .RDLC file
                List <HotelGuest> guestSet = new List <HotelGuest>();
                var foundGuest             = guestManager.GetHotelGuest(guestId);
                guestSet.Add(foundGuest);
                reportDataSource1.Value = guestSet;
                RvHostArea.LocalReport.DataSources.Add(reportDataSource1);

                ReportDataSource reportDataSource2 = new ReportDataSource
                {
                    Name = "InvoiceDetailsDataset"
                };
                //Name of the report dataset in our .RDLC file
                List <InvoiceDetails> invoiceSet = new List <InvoiceDetails>
                {
                    invoiceManager.RetrieveInvoiceByGuest(guestId)
                };
                reportDataSource2.Value = invoiceSet;
                RvHostArea.LocalReport.DataSources.Add(reportDataSource2);

                ReportDataSource reportDataSource3 = new ReportDataSource
                {
                    Name  = "BookingDetailsSet",
                    Value = invoiceManager.RetrieveGuestBookingDetailsList(guestId)
                };
                //Name of the report dataset in our .RDLC file
                RvHostArea.LocalReport.DataSources.Add(reportDataSource3);

                ReportDataSource reportDataSource4 = new ReportDataSource
                {
                    Name = "ZipCodeDataset"
                };
                //Name of the report dataset in our .RDLC file
                List <CityState> zipSet = new List <CityState>
                {
                    foundGuest.CityState
                };
                reportDataSource4.Value = zipSet;
                RvHostArea.LocalReport.DataSources.Add(reportDataSource4);

                RvHostArea.LocalReport.ReportEmbeddedResource = "com.WanderingTurtle.FormPresentation.Views.PrintableInvoice.rdlc";
                RvHostArea.RefreshReport();
            }
            catch (Exception ex)
            {
                throw new WanderingTurtleException(this, ex);
            }
        }
示例#4
0
        private void ShowInvoices()
        {
            var isFormValid = true;

            if (!ClientsNames.Contains(txtClientName.Text.FullTrim()))
            {
                isFormValid = false;
                ShowErrorMsg(Resources.MakeSureOfClientName);
            }
            if (!isFormValid)
            {
                return;
            }
            ClientInvoices = InvoiceManager
                             .GetClientRemainingInvoices(ClientManager.GetClientIdByName(txtClientName.Text.FullTrim()))
                             .OrderBy(invoice => invoice.Date).ToList();
            if (ClientInvoices.Any())
            {
                FillGrid();
            }
            else
            {
                ShowInfoMsg(Resources.ClientHasNoRemainingInvoices);
                dgvInvoices.DataSource = null;
                dblInTotal.Value       = 0;
            }
        }
        public void TaxCorrectionOnReturnInvoice(Invoice invoice, object[] objPageDetails)
        {
            invoice.fltBalanceDue -= (invoice.fltGovernmentTaxAmount + invoice.fltProvincialTaxAmount);
            InvoiceManager IM = new InvoiceManager();

            IM.CalculateNewInvoiceReturnTotalsToUpdate(invoice, objPageDetails);
        }
示例#6
0
        /// <summary>
        /// Indexes this instance.
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            InvoiceManager manager = new InvoiceManager();

            List <SalesByInvoiceTypeViewModel> salesByInvoiceType = new List <SalesByInvoiceTypeViewModel>();
            int itemId = 0;

            foreach (var item in manager.GetAll().GroupBy(x => x.Type))
            {
                salesByInvoiceType.Add(new SalesByInvoiceTypeViewModel()
                {
                    label = $"Type {item.Key}",
                    data  = item.Sum(x => x.CalculateInvoiceTotalPriceWithTaxes()),
                    color = ChartColors.Colors[itemId],
                    id    = itemId.ToString()
                });
                itemId++;
            }

            var labels = salesByInvoiceType.Select(x => x.label).ToArray();
            var values = salesByInvoiceType.Select(x => x.data).ToArray();

            ViewBag.DataChart   = JsonConvert.SerializeObject(values);
            ViewBag.LabelsChart = JsonConvert.SerializeObject(labels);
            return(View());
        }
示例#7
0
        public ActionResult MadeSumit(MadeOutInvoceInput input)
        {
            IInvoice invoice = new InvoiceManager();
            var      result  = invoice.MadeOutInvoce(input);

            return(View("Detail", result));
        }
示例#8
0
        /// <summary>
        /// 设置发票停用状态
        /// </summary>
        private void SetInvoiceStatsu()
        {
            try
            {
                if (MessageBox.Show("确定要停用该卷发票吗?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }

                if (dgvInvoiceList.Rows.Count == 0)
                {
                    return;
                }

                int id = Convert.ToInt32(dgvInvoiceList["ID", dgvInvoiceList.CurrentCell.RowIndex].Value);

                InvoiceManager.SetInvoiceNoUsed(id);

                ShowGridList(GetStatusFilterString());
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#9
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dgvInvoiceList.Rows.Count == 0)
            {
                return;
            }

            if (MessageBox.Show("确定要删除该卷发票记录吗?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            try
            {
                int volId = Convert.ToInt32(dgvInvoiceList["ID", dgvInvoiceList.CurrentRow.Index].Value);
                if (InvoiceManager.DeleteInvoiceVolumn(volId))
                {
                    ShowGridList(GetStatusFilterString());
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#10
0
        /// <summary>
        /// Ejecuta el pago contemplando los distintos métodos de pago.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void PerformCheckout(object sender, EventArgs e)
        {
            try
            {
                InvoiceManager       invoiceManager = new InvoiceManager();
                List <PaymentMethod> paymenMethods  = new List <PaymentMethod>();

                //Modelo la factura
                Invoice invoice = new Invoice();
                invoice.User           = SessionHelper.GetUser();
                invoice.BillingAddress = GetBillingAddress();
                invoice.CreditCard     = GetCreditCard();
                invoice.CreditNotes    = GetCreditNotes();
                invoice.InvoiceItems   = GetInvoiceItems();

                // Procesamiento del pago y creación de la facturación
                bool success = invoiceManager.ProcessPayment(invoice);

                if (!success && invoiceManager.HasErrors)
                {
                    ((front)Master).Alert.Show("Error", invoiceManager.ErrorDescription);
                }
                else
                {
                    SessionUtilHelper.KeepInSession(invoice.Id.ToString(), Session);
                    Response.Redirect("/invoice_finish.aspx");
                }
            } catch (Exception exception)
            {
                ((front)Master).Alert.Show("Exception", exception.Message);
            }
        }
示例#11
0
        protected string generateInvoicePDF(int invoiceID)
        {
            string reportPath = null;

            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();

            invoiceReport = InvoiceManager.GetInvoiceForReport(invoiceID);

            if (invoiceReport != null)
            {
                reportViewer.Reset();

                reportViewer.LocalReport.DataSources.Clear();

                reportViewer.LocalReport.EnableExternalImages = true;

                ReportDataSource reportDataSource = new ReportDataSource();

                reportDataSource.Name = "DataSet1";

                reportDataSource.Value = invoiceReport;

                reportViewer.LocalReport.DataSources.Add(reportDataSource);

                reportViewer.LocalReport.ReportPath = Server.MapPath("~/Content/Invoice.rdlc");

                reportViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(subReportsEventHandler);

                reportPath = string.Format("{0}/Temp/Invoice_{1}.pdf", appPath, invoiceID);

                Core.ReportHelper.savePDFFromLocalReport(reportViewer.LocalReport, reportPath);
            }

            return(reportPath);
        }
示例#12
0
        public void InsertNewDetailInvoice()
        {
            //ARRANGE
            InvoiceManager manager = new InvoiceManager();
            long           id      = 1006;
            var            invoice = new Invoice()
            {
                Id   = id,
                Type = Types.A.ToString()
            };

            manager.Insert(invoice);
            var detailsBeforeInsert = invoice.GetDetail().ToList();

            //ACT
            var detailToInsert = new InvoiceDetail()
            {
                Id          = id,
                Invoice     = invoice,
                Description = "Venta insumos varios",
                Amount      = 14,
                UnitPrice   = 4.33
            };

            var invoiceFromManager = manager.GetById(id);

            invoiceFromManager.AddDetail(detailToInsert);

            var detailInserted = invoiceFromManager.GetDetail().FirstOrDefault();

            //ASSERT
            Assert.AreNotEqual(detailsBeforeInsert.Count(), invoiceFromManager.GetDetail().Count());
            Assert.AreEqual(detailToInsert, detailInserted);
        }
示例#13
0
    //public bool deletePayment(int payment_no)
    //{
    //    SQL = "delete  from customer_payment where EmailItemID = " + EmailItemID + " and payment_no=" + payment_no;
    //    Cmd = new SqlCommand(SQL, Con);
    //    int rowCount = 0;
    //    try
    //    {
    //        Con.Open();
    //        rowCount = Int32.Parse(Cmd.ExecuteNonQuery().ToString());
    //    }
    //    catch (Exception ex)
    //    {
    //        throw ex;
    //    }
    //    finally
    //    {
    //        Con.Close();
    //    }
    //    if (rowCount == 1)
    //    {
    //        return true;
    //    }
    //    else
    //    {
    //        return false;
    //    }
    //}



    public PaymentManager(string elt_acct) : base(elt_acct)
    {
        pdMgr  = new PaymentDetailManager(elt_account_number);
        AAJMgr = new AllAccountsJournalManager(elt_account_number);
        ivMgr  = new InvoiceManager(elt_account_number);
        ccMgr  = new CustomerCreditManager(elt_account_number);
    }
        protected void GrdInvoiceSelection_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //Collects current method for error tracking
            string method = "GrdInvoiceSelection_RowCommand";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //Sets the string of the command argument(invoice number
                int            invoiceID = Convert.ToInt32(e.CommandArgument.ToString());
                InvoiceManager IM        = new InvoiceManager();
                if (IM.InvoiceIsReturn(invoiceID, objPageDetails))
                {
                    //Changes page to display a printable invoice
                    Response.Redirect("PrintableInvoiceReturn.aspx?invoice=" + invoiceID.ToString(), false);
                }
                else
                {
                    //Changes page to display a printable invoice
                    Response.Redirect("PrintableInvoice.aspx?invoice=" + invoiceID.ToString(), false);
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
示例#15
0
        public void DeleteInvoice()
        {
            #region Escribir el código dentro de este bloque

            try
            {
                InvoiceManager manager = new InvoiceManager();
                long           id      = 1002;

                //Identifico el objeto/factura que deseo eliminar
                Invoice invoice = manager.GetById(id);

                //Elimino de mis registros esa factura
                manager.Delete(invoice.Id);

                //Busco en mis registros si sigue existiendo la factura que eliminé, y la traigo por Id
                Invoice result = manager.GetById(invoice.Id);

                //Si no son iguales está OK, ya que eso me demuestra que se eliminó el registro con éxito
                Assert.AreNotEqual(invoice, result);
            }
            catch (Exception ex)
            {
                //Cambio la exepción no implementada, por el retorno del mensaje de error
                throw new Exception(ex.Message.ToString());
            }

            #endregion Escribir el código dentro de este bloque
        }
示例#16
0
 public AccountingInstance(Staff s, InvoiceManager im, UserManager um, VehicleManager vm) : base(im, um, vm)
 {
     if (s.Role != JobRole.Accounting)
     {
         throw new System.InvalidOperationException("Invalid User! Cannot create accounting instance!");
     }
 }
示例#17
0
        public void UpdateInvoiceDetail()
        {
            //En este puto realizo correción sobre el Id que se asigna a InvoiceId; asignando el valore correspondiente( es el Id de la factura) 1003 + el Id del detalle, Id 1 y 2
            long                  id      = 1003;
            InvoiceManager        manager = new InvoiceManager();
            IList <InvoiceDetail> detail  = new List <InvoiceDetail>();

            detail.Add(new InvoiceDetail()
            {
                Id          = 1,
                InvoiceId   = id,
                Description = "Venta insumos varios",
                Amount      = 14,
                UnitPrice   = 4.33
            });

            detail.Add(new InvoiceDetail()
            {
                Id          = 2,
                InvoiceId   = id,
                Description = "Venta insumos tóner",
                Amount      = 5,
                UnitPrice   = 87
            });

            manager.UpdateDetail(id, detail);
            Invoice result = manager.GetById(id);

            Assert.AreEqual(3, Convert.ToInt32(result.GetDetail().Count()));
        }
示例#18
0
        public IActionResult AddLine(InvoiceViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var result = InvoiceManager.AddLine(model.InvoiceLine, CurrentUser, false, true);

                    TempData["Success"] = $"Dodano nową linię do faktury <b>{model.InvoiceNumber}</b>";

                    return(RedirectToAction("AddLine", new { model.InvoiceLine.InvoiceId }));
                }

                var line = model.InvoiceLine;

                model             = InvoiceManager.GetInvoiceViewModelById(line.InvoiceId);
                model.InvoiceLine = line;

                return(View(model));
            }
            catch (Exception e)
            {
                var innerMessage = e.InnerException == null ? "" : $": {e.InnerException.Message}";
                TempData["Error"] = $"Wystąpił problem podczas dodwania nowej linii do faktury: {e.Message}{innerMessage}";
            }

            return(RedirectToAction("Index"));
        }
示例#19
0
        // GET: Invoice/Home
        public ActionResult Detail(string ticketSn, string account, string password)
        {
            //调用查询接口
            IInvoice invoice = new InvoiceManager();

            //GeneralEInvoice(detail);
            //detail.DownLoadUrl = string.Format("{0}download/{1}.svg", "../../", detail.InvoiceNumber);

            var input = new QueryInoviceInput()
            {
                ticketSn = ticketSn,
                account  = account,
                password = password
            };
//            var input2 = new MadeOutInvoceInput()
//            {
//                ticketSn = "201703191723038690020",
//                account = "adasun4",
//                shopperInfo = new ShopperInfo()
//                {
//                    email= "*****@*****.**",
//                    mobilePhone="13600927865",
//                    invoiceTitle= "个人(叶工)",
//                    industryType= 3
//                },
//                password = "******"
//            };

            var result = invoice.QueryInovice(input);

//            var result2 = invoice.MadeOutInvoce(input2);

            return(View(result));
        }
示例#20
0
        public IActionResult Edit(string id)
        {
            try
            {
                var invoice = InvoiceManager.GetInvoiceViewModelById(id);
                invoice.InvoiceLines = InvoiceManager.GetInvoiceLineViewModels(id);
                invoice.InvoiceLine  = new InvoiceLineViewModel();

                invoice.BudgetItemList   = InvoiceManager.GetOpenBudgetsItemList(invoice.Budget);
                invoice.CustomerItemList = InvoiceManager.GetOpenCustomersItemList(invoice.Customer);

                invoice.Attachments = AttachmentManager.GetAttachmentViewModelsForDocument(DocumentType.Invoice, id);

                return(View(invoice));
            }
            catch (Exception e)
            {
                //Console.WriteLine(e.Message);
                //throw;
                var innerMessage = e.InnerException == null ? "" : $": {e.InnerException.Message}";
                TempData["Error"] = $"Wystąpił problem podczas edytowania faktury: {e.Message}{innerMessage}";
            }

            return(RedirectToAction("Index"));
        }
示例#21
0
        public InvoicesApplication()
        {
            var invoiceRepository = ObjectFactory.GetInstance <IinvoiceRepository>();

            mgr   = new InvoiceManager(invoiceRepository);
            tsmgr = new TSInvoiceRelationManager(ObjectFactory.GetInstance <ITSInvoiceRelationRpository>());
        }
示例#22
0
        public IActionResult EditLineJson(InvoiceLineViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var result = InvoiceManager.EditLine(model, CurrentUser, false, true);

                    return(Json(new
                    {
                        success = true,
                        InvoiceLine = result
                    }));
                }
            }
            catch (Exception e)
            {
                var innerMessage = e.InnerException == null ? "" : $": {e.InnerException.Message}";

                ModelState.AddModelError("", e.Message + innerMessage);
            }

            return(Json(new
            {
                success = false,
                errors = ModelState.Keys.SelectMany(k => ModelState[k].Errors)
                         .Select(m => m.ErrorMessage).ToArray()
            }));
        }
示例#23
0
        private void Pay()
        {
            var enteredAmount = (decimal)dblInPaid.Value;
            var paidInvoices  = new List <KeyValuePair <DateTime, decimal> >();

            foreach (var invoice in ClientInvoices)
            {
                if (enteredAmount <= 0)
                {
                    break;
                }
                var paid = invoice.Remaining <= enteredAmount ? invoice.Remaining : enteredAmount;
                InvoicePaymentManager.AddInvoicePayment(new InvoicePayment
                {
                    Date      = dtPaymentDate.Value,
                    InvoiceId = invoice.InvoiceId,
                    Paid      = paid
                });
                paidInvoices.Add(new KeyValuePair <DateTime, decimal>(invoice.Date, paid));
                InvoiceManager.UpdateInvoicePaidAmount(invoice.InvoiceId, paid);
                enteredAmount -= paid;
            }
            ShowSuccessMsg(paidInvoices, (decimal)dblInRemaining.Value);
            ShowInvoices();
        }
示例#24
0
        /// <summary>
        /// Ejecuta la creación y descarga de la factura.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void PerformDownload(object source, RepeaterCommandEventArgs e)
        {
            try
            {
                InvoiceManager invoiceManager = new InvoiceManager();
                string         url            = invoiceManager.DownloadInvoice(Convert.ToInt32(e.CommandArgument));

                if (invoiceManager.HasErrors)
                {
                    ((front)Master).Alert.Show("Error", invoiceManager.ErrorDescription);
                }
                else
                {
                    HttpResponse res = HttpContext.Current.Response;
                    res.Clear();
                    res.AppendHeader("content-disposition", "attachment; filename=PaymentReceipt.pdf");
                    res.ContentType = "application/octet-stream";
                    res.WriteFile(url);
                    res.Flush();
                    res.End();
                }
            }
            catch (Exception exception)
            {
                ((front)Master).Alert.Show("Exception", exception.Message);
            }
        }
示例#25
0
        public static void deleteInvoice(string sInvoiceID)
        {
            Invoice invoice = null;
            Claim   claim   = null;

            try {
                int invoiceID = Convert.ToInt32(Core.SecurityManager.DecryptQueryString(sInvoiceID));

                using (TransactionScope scope = new TransactionScope()) {
                    invoice = InvoiceManager.Get(invoiceID);
                    if (invoice != null)
                    {
                        invoice.IsVoid = true;

                        InvoiceManager.Save(invoice);

                        // change claim progress status
                        claim = ClaimsManager.GetByID(invoice.ClaimID);
                        if (claim != null)
                        {
                            claim.ProgressStatusID = (int)Globals.ClaimProgressStatus.ClaimInvoiceRejectedRedo;

                            ClaimsManager.Save(claim);

                            scope.Complete();
                        }
                    }
                }
            }
            catch (Exception ex) {
                Core.EmailHelper.emailError(ex);
            }
        }
示例#26
0
        public void DeleteInvoice()
        {
            /*
             * 1- Eliminar la factura con id=4
             * 2- Comprobar de que la factura con id=4 ya no exista
             * 3- La prueba tiene que mostrarse que se ejecuto correctamente
             */

            #region Escribir el código dentro de este bloque

            InvoiceManager manager = new InvoiceManager();
            long           id      = 4;
            Invoice        invoice = new Invoice()
            {
                Id = id
            };

            manager.Delete(id);

            bool exists = manager.Exists(id);

            Assert.IsFalse(exists);

            #endregion Escribir el código dentro de este bloque
        }
示例#27
0
        public void UpdateInvoiceDetail()
        {
            long                  id      = 1002;
            InvoiceManager        manager = new InvoiceManager();
            IList <InvoiceDetail> detail  = new List <InvoiceDetail>();

            detail.Add(new InvoiceDetail()
            {
                Id          = 1,
                InvoiceId   = id,
                Description = "Venta insumos varios",
                Amount      = 14,
                UnitPrice   = 4.33
            });

            detail.Add(new InvoiceDetail()
            {
                Id          = 2,
                InvoiceId   = id,
                Description = "Venta insumos tóner",
                Amount      = 5,
                UnitPrice   = 87
            });

            manager.UpdateDetail(id, detail);
            Invoice result = manager.GetById(id);

            Assert.AreEqual(2, result.GetDetail().Count());
        }
示例#28
0
        public void CalculateInvoiceTotalPriceWithTaxes()
        {
            //La modificación que realizé sobre este método, es crear una sumatoria auxiliar, para tener un valor comparativo contra cual verificar dicha suma.
            long           id      = 1003;
            InvoiceManager manager = new InvoiceManager();
            Invoice        invoice = manager.GetById(id);

            double sum = 0;
            double aux = 0;

            foreach (InvoiceDetail item in invoice.GetDetail())
            {
                sum += item.TotalPrice * item.Taxes;
            }

            foreach (InvoiceDetail item in invoice.GetDetail())
            {
                aux += item.TotalPrice * item.Taxes;
            }

            //Si las sumas de los totales, dan un valor mayor a cero, verifico con un Assert si los montos Sum y Aux son iguales
            if ((sum + aux) > 0)
            {
                Assert.AreEqual(sum, aux);
            }
        }
示例#29
0
        protected void lnkCompleteSale_Click(object sender, EventArgs e)
        {
            //get all the invoiceitem list
            InvoiceLineItemList lineItemList = Session["lineItemList"] as InvoiceLineItemList;

            //create an invoice
            Invoice newInvoice = new Invoice();

            BuildNewInvoice(lineItemList, newInvoice);

            newInvoice.InvoiceID = InvoiceManager.Save(newInvoice);
            _invoiceID           = newInvoice.InvoiceID;

            //save each line item from the line item list
            foreach (InvoiceLineItem lineItem in lineItemList)
            {
                lineItem.InvoiceID = newInvoice.InvoiceID;
                //save line items
                InvoiceLineItemManager.Save(lineItem);

                //Update the stock quantity after the lineItem has been saved
                ProductManager.UpdateUnitsOnHand(lineItem, "subtract");

                //check if a lineitem is a Prepaid Water Pkg
                HandlePrepaidWaterPackages(newInvoice, lineItem);
            }

            //reset the account id
            _accountID = -1;
            //clean up session variables
            Session["productID"]    = null;
            Session["lineItemList"] = null;
            Session["accountID"]    = null;
        }
示例#30
0
        protected void LoadInvoiceListing(string query)
        {
            dt = InvoiceManager.LoadListing(query);

            gdvList.DataSource = dt;
            gdvList.Columns["journal_entry_id"].Visible    = false;
            gdvList.Columns["date"].HeaderText             = "Date";
            gdvList.Columns["reference_number"].HeaderText = "Ref";
            gdvList.Columns["cheque_number"].HeaderText    = "Cheque";
            gdvList.Columns["batch_id"].HeaderText         = "Batch";
            gdvList.Columns["transaction_amt"].HeaderText  = "Amount";
            gdvList.Columns["dr_account"].HeaderText       = "Dr Acc";
            gdvList.Columns["cr_account"].HeaderText       = "Cr Acc";
            gdvList.Columns["is_on_hold"].HeaderText       = "On Hold";
            gdvList.Columns["is_posted"].HeaderText        = "Posted";

            gdvList.RowsDefaultCellStyle.BackColor            = Color.LightGray;
            gdvList.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;
            gdvList.ColumnHeadersDefaultCellStyle.ForeColor   = Color.White;
            gdvList.ColumnHeadersDefaultCellStyle.BackColor   = Color.Black;
            gdvList.RowHeadersDefaultCellStyle.BackColor      = Color.Black;
            gdvList.DefaultCellStyle.SelectionBackColor       = Color.Cyan;
            gdvList.DefaultCellStyle.SelectionForeColor       = Color.Black;
            foreach (DataGridViewColumn c in this.gdvList.Columns)
            {
                c.DefaultCellStyle.Font = new System.Drawing.Font("Arial", 12f, GraphicsUnit.Pixel);
            }
            this.gdvList.ColumnHeadersDefaultCellStyle.BackColor = Color.CadetBlue;
            this.gdvList.EnableHeadersVisualStyles = false;
        }