public void GetAllReciepts_Should_Return_A_Previously_Saved_Reciept() { var reciepts = new RecieptManager(); //Add new reciept var reciept = new Reciept(); reciept.KingdomHallFund = 100; reciept.WorldWideWork = 100; reciept.Congregation = 200; reciepts.AddReciept(reciept); //list it back out var recieptsList = reciepts.GetAllReciepts(); //make sure its in the list foreach (var rec in recieptsList) { if (rec.ID == reciept.ID && rec.Congregation == reciept.Congregation && rec.KingdomHallFund == reciept.KingdomHallFund && rec.WorldWideWork == reciept.WorldWideWork && rec.Miscellaneous1 == reciept.Miscellaneous1 && rec.Miscellaneous1Name == reciept.Miscellaneous1Name && rec.Miscellaneous2 == reciept.Miscellaneous2 && rec.Miscellaneous2Name == reciept.Miscellaneous2Name && rec.Date == reciept.Date) { return; } } //If it wasnt in the list, then we didnt return. so we must not of //been able to find the recipet in the database. this test must FAIL Assert.Fail(); }
/// <summary> /// Add a new recipet to the store /// </summary> /// <param name="reciept"></param> public void AddReciept(Reciept reciept) { //Do not allow unnamed amounts if (reciept.Miscellaneous1 != 0 && reciept.Miscellaneous1Name == "") { throw new Exception("Cannot Have An Unnamed Misc Field"); } if (reciept.Miscellaneous2 != 0 && reciept.Miscellaneous2Name == "") { throw new Exception("Cannot Have An Unnamed Misc Field"); } //do not allow negitive numbers if (reciept.WorldWideWork < 0 || reciept.Congregation < 0 || reciept.KingdomHallFund < 0 || reciept.Miscellaneous1 < 0 || reciept.Miscellaneous2 < 0) { throw new Exception("Cannot Have A Negitive Value"); } //All good. Allow it into the database database.Reciepts.Add(reciept); database.SaveChanges(); }
public void CreateReciept_Should_Throw_An_Error_If_A_Misc_Field_Is_Used_But_Not_Named() { var reciepts = new RecieptManager(); var reciept = new Reciept(); reciept.Miscellaneous1 = 100; reciepts.AddReciept(reciept); }
public void CreateReciept_Should_Throw_An_Error_If_Any_Field_Has_A_Negitive_Value() { var reciepts = new RecieptManager(); var reciept = new Reciept(); reciept.Miscellaneous1 = -100; reciepts.AddReciept(reciept); }
public void buyCart() { // Calculate costs double subTotal = cart.cartTotal; double taxToPay = Math.Floor(cart.cartTotal * tax); double total = subTotal + taxToPay; // Make reciept reciept = new Reciept(subTotal, taxToPay, total); createReciept(reciept); }
public void CreateReciept() { var reciepts = new RecieptManager(); var reciept = new Reciept(); reciept.KingdomHallFund = 100; reciept.WorldWideWork = 100; reciept.Congregation = 200; reciepts.AddReciept(reciept); }
public HttpResponseMessage AddReciept(Reciept reciept) { try { var reciepts = new RecieptManager(); reciepts.AddReciept(reciept); } catch (Exception exception) { return Request.CreateResponse(HttpStatusCode.BadRequest, exception.Message); } return Request.CreateResponse<Reciept>(HttpStatusCode.Created, reciept); }
public void Calculate(double subtotal) { Subtotal = subtotal; Reciept discount = new Reciept(0); if (subtotal > 0.0 || subtotal < 499) { discount.DiscountRate = 0; } else if (subtotal > 500 || subtotal < 999) { discount.DiscountRate = 5; } else if (subtotal > 1000 || subtotal < 4999) { discount.DiscountRate = 10; } else if (subtotal > 5000) { discount.DiscountRate = 15; } }
public async Task <System.Net.Http.HttpResponseMessage> CreateReciept(string userName, Reciept reciept) { var request = new HttpRequestMessage(HttpMethod.Put, _testConfig.CreateReciept.Replace("{userName}", userName)); request.Content = new StringContent(JsonConvert.SerializeObject(reciept), System.Text.Encoding.UTF8, JsonContentType); var response = await call(request); return(response); }
/// <summary> /// Edit a reciept /// </summary> /// <returns></returns> public void RemoveReciept(Reciept reciept) { database.Reciepts.Remove(reciept); database.SaveChanges(); }
private static void ShowItems(ThermalPrinter printer, Reciept reciept) { foreach(Item item in reciept.getItems()) { printer.Reset(); // .PadLeft(Math.Abs(item.ItemName.Length - 30)); string output = item.Quantity.PadRight(2) + " " + item.Size.PadRight(5) + " " + item.Sugar.PadRight(2) + " " + item.ItemName.Trim() + " " + (item.Price.Trim() + ".SR").PadLeft(Math.Abs(item.ItemName.Length - 29)); printer.WriteLine(output); if (item.Components.Trim().Length > 3 ) { printer.WriteLine(item.Components.Trim()); } if (item.Additionals.Trim().Length > 3) { printer.WriteLine(item.Additionals.Trim()); } printer.Reset(); } }
protected void inputTextbox_TextChanged(object sender, EventArgs e) { double noob = double.Parse(inputTextbox.Text); Reciept lol = new Reciept(noob); }
private double CalculateFine(TimeSpan interval, Reciept reciept) { double fine = reciept.Tariff.Price * interval.TotalHours * reciept.Transport.Coef * reciept.Transport.CorrectCoef * fineCoef; return(Math.Round(fine)); }
public FmRecieptForReturn(Reciept reciept) { this.reciept = reciept; InitializeComponent(); FillCtlParkings(GetParkings()); }
public void printReciept(User user) { Reciept reciept = new Reciept(user); reciept.print(); }
public byte[] TestQrcode(string qrcode) => Reciept = Reciept .Add(SelectJustification(Justification.Center), PrintQRCode(qrcode, qrCodeSize: QRCodeSize.Large), CarriageReturn, CarriageReturn, CarriageReturn);
public Reciept Post(Reciept reciept) { return(categoryRepository.AddReciept(reciept)); }
/// <summary> /// Edit a reciept /// </summary> /// <returns></returns> public void UpdateReciept(Reciept reciept) { database.SaveChanges(); }
public UnsettledReciept(Reciept reciept) { base.Reciept = reciept; this.Name = "Unsettled"; }
public ActionResult ReceiptSave([Bind(Include = "RecieptId, RDate,Amount,PayMode,PayDetails,ChargeId")] Reciept reciept) { if (ModelState.IsValid) { if (reciept.PayMode == (int)PayTypeEnum.CashCard) { using (var transaction = db.GetTransaction()) { try //make Card transaction, update card balance and save this { var card = db.Single <CashCard>("select * from CashCard where CardName=@0", reciept.PayDetails.Trim()); var cardIssu = db.Single <CardIssue>("Select ci.* from CashCard c, cardissue ci where c.CardId=ci.CardId and c.discarded=0 and c.CardName=@0 " + "and GetDate() between ci.IssuedOn and coalesce(ci.ReturnedOn,GetDate()) and ci.ExpiresOn>GETDATE()", card.CardName); reciept.ChargeType = (int)ChargeTypeEnum.Restaurant; if (reciept.RecieptID > 0)//Edit mode { var re = db.Single <Reciept>(reciept.RecieptID); card.Amount += (decimal)re.Amount; if (card.Amount < reciept.Amount) { db.AbortTransaction(); return(RedirectToAction("ErrorCust", "Home", new { err = "Insufficient Balance" })); } card.Amount -= (decimal)reciept.Amount; db.Insert(new CardTransaction { RechargeAmt = re.Amount, AmountSpent = reciept.Amount, CardIssueId = cardIssu.CardIssueId, OTID = reciept.ChargeID, TDateTime = DateTime.Now }); db.Update(reciept); } else { if (card.Amount < reciept.Amount) { db.AbortTransaction(); return(RedirectToAction("ErrorCust", "Home", new { err = "Insufficient Balance" })); } card.Amount -= (decimal)reciept.Amount; db.Insert(new CardTransaction { AmountSpent = reciept.Amount, CardIssueId = cardIssu.CardIssueId, OTID = reciept.ChargeID, TDateTime = DateTime.Now }); db.Insert(reciept); } db.Update(card); transaction.Complete(); } catch (Exception ex) { db.AbortTransaction(); throw ex; } } } reciept.ChargeType = (int)ChargeTypeEnum.Restaurant; var r = (reciept.RecieptID > 0) ? db.Update(reciept) : db.Insert(reciept); return(RedirectToAction("Receipt", new { id = reciept.ChargeID })); } return(RedirectToAction("Receipt", new { id = reciept.ChargeID })); }
// file format // cash@ discount @ total // quantity @ size @ itemname @ sugar @ price @ component @ additional private static Reciept getReciept(string filename) { Reciept receipt = new Reciept(); try { using (StreamReader reader = new StreamReader(filename)) { string line = reader.ReadLine(); receipt.cash = line.Split('@')[0]; receipt.discount = line.Split('@')[1]; receipt.total = line.Split('@')[2]; while ((line = reader.ReadLine()) != null) { if (line.Trim().Length < 1) break; Item item = new Item(); string [] arr = line.Split('@'); string quantity = arr[0]; string size= arr[1]; string itemName= arr[2]; string sugar= arr[3]; string price= arr[4]; string components = arr[5]; string addtitionals = arr[6]; item.Quantity = quantity.Trim(); item.Size = size.Trim(); item.ItemName = itemName.Trim(); item.Sugar = sugar.Trim(); item.Price = price.Trim(); item.Components = components.Trim(); item.Additionals = addtitionals.Trim(); receipt.add(item); } } } catch (Exception) { } return receipt; }
public IEnumerable <Bill> GetBillsByReciept(Reciept reciept) { return(FindBy(x => x.RecieptId == reciept.Id)); }
public void RemoveReciept_Shuould_Delete_A_Reciept_From_The_Database() { var reciepts = new RecieptManager(); //Add new reciept var reciept = new Reciept(); reciept.KingdomHallFund = 100; reciept.WorldWideWork = 100; reciept.Congregation = 200; reciepts.AddReciept(reciept); //Make sure its there Assert.IsNotNull(reciepts.GetReciept(reciept.ID)); //Now Delete it reciepts.RemoveReciept(reciept); //Make sure its NOT there Assert.IsNull(reciepts.GetReciept(reciept.ID)); }
public ActionResult Index(IndexVm model) { if (ModelState.IsValid) { // Fetch the register info from the server and NOT from the POST data. // Otherwise users could manipulate the data var registerInfo = RegisterChild(); // Create a Reciept object to store info about the purchaser var reciept = new Reciept() { FirstName = model.FirstName, LastName = model.LastName, Email = model.Email, PaymentDate = registerInfo.RegisterDate }; schoolEntities.Reciepts.Add(reciept); schoolEntities.SaveChanges(); // Get PayPal API Context using configuration from web.config var apiContext = GetApiContext(); // Create a new payment object var payment = new Payment { experience_profile_id = "XP-KU35-EK4V-QK8Y-6G58", // Created in the WebExperienceProfilesController. This one is for DigitalGoods. intent = "sale", payer = new Payer { payment_method = "paypal" }, transactions = new List <Transaction> { new Transaction { description = $"Registration Fee (Single Payment) for {registerInfo.RegisterDate:dddd, dd MMMM yyyy}", amount = new Amount { currency = "USD", total = (registerInfo.Price / 100M).ToString(), // PayPal expects string amounts, eg. "20.00" }, item_list = new ItemList() { items = new List <Item>() { new Item() { description = $"Registration fee (Single Payment) for {registerInfo.RegisterDate:dddd, dd MMMM yyyy}", currency = "USD", quantity = "1", price = (registerInfo.Price / 100M).ToString(), // PayPal expects string amounts, eg. "20.00" } } } } }, redirect_urls = new RedirectUrls { return_url = Url.Action("Return", "Single", null, Request.Url.Scheme), cancel_url = Url.Action("Cancel", "Single", null, Request.Url.Scheme) } }; // Send the payment to PayPal var createdPayment = payment.Create(apiContext); // Save a reference to the paypal payment reciept.PayPalReference = createdPayment.id; schoolEntities.SaveChanges(); // Find the Approval URL to send our user to var approvalUrl = createdPayment.links.FirstOrDefault( x => x.rel.Equals("approval_url", StringComparison.OrdinalIgnoreCase)); // Send the user to PayPal to approve the payment return(Redirect(approvalUrl.href)); } return(View(model)); }
public void UpdateReciept_Shuould_Save_Chanes_In_The_Database() { var reciepts = new RecieptManager(); //Add new reciept var originalReciept = new Reciept(); originalReciept.KingdomHallFund = 100; originalReciept.WorldWideWork = 100; originalReciept.Congregation = 200; reciepts.AddReciept(originalReciept); //change something originalReciept.KingdomHallFund = 33; reciepts.UpdateReciept(originalReciept); //get it back out of the DB var newReciept = reciepts.GetReciept(originalReciept.ID); //Compare it if (newReciept.ID != originalReciept.ID || newReciept.Congregation != originalReciept.Congregation || newReciept.KingdomHallFund != originalReciept.KingdomHallFund || newReciept.WorldWideWork != originalReciept.WorldWideWork || newReciept.Miscellaneous1 != originalReciept.Miscellaneous1 || newReciept.Miscellaneous1Name != originalReciept.Miscellaneous1Name || newReciept.Miscellaneous2 != originalReciept.Miscellaneous2 || newReciept.Miscellaneous2Name != originalReciept.Miscellaneous2Name || newReciept.Date != originalReciept.Date) { Assert.Fail(); } }
public UnsettledState(Reciept reciept) { base.Reciept = reciept; this.StateInfo = "Unsettled"; }
public async Task <ActionResult <Reciept> > UpdateReciept(string userName, int id, Reciept recieptToUpdate) { var userByUserName = await _userService.GetUserByUserName(userName); if (userByUserName == null) { return(NotFound($"User not found for userName: {userName}")); } var reciept = await _recieptService.GetRecieptById(id); if (reciept == null) { return(NotFound($"Reciept not found for id: {id}")); } if (!ModelState.IsValid || userName != recieptToUpdate.UserName || id != recieptToUpdate.Id) { return(BadRequest(ModelState)); } recieptToUpdate.UserName = userName; var updatedReciept = await _recieptService.UpdateReciept(recieptToUpdate); return(Ok(updatedReciept)); }
public Result SaveReciept(Reciept req) { return(bll.SaveReciept(req)); }
public void GetReciept_Should_Return_A_Previously_Saved_Reciept() { var reciepts = new RecieptManager(); //Add new reciept var reciept = new Reciept(); reciept.KingdomHallFund = 100; reciept.WorldWideWork = 100; reciept.Congregation = 200; reciepts.AddReciept(reciept); //get it back out of the DB var newReciept = reciepts.GetReciept(reciept.ID); Assert.IsNotNull(newReciept); //Compare it if (newReciept.ID != reciept.ID || newReciept.Congregation != reciept.Congregation || newReciept.KingdomHallFund != reciept.KingdomHallFund || newReciept.WorldWideWork != reciept.WorldWideWork || newReciept.Miscellaneous1 != reciept.Miscellaneous1 || newReciept.Miscellaneous1Name != reciept.Miscellaneous1Name || newReciept.Miscellaneous2 != reciept.Miscellaneous2 || newReciept.Miscellaneous2Name != reciept.Miscellaneous2Name || newReciept.Date != reciept.Date) { Assert.Fail(); } }
//Creates the reciept using the parts stored in each individual reciept. This then displays the parts in the full parts rich text box, along with the price and quantity of specific parts. private void CreateReciept() { //Ensures that only 1 receipt is displaye at a time reciept.Clear(); //Creates a new reciept object Reciept reciepts = new Reciept(); //Creates reciets lists for all parts reciepts.orderCase = new List <Case>(); reciepts.orderMotherboard = new List <Motherboard>(); reciepts.orderCPU = new List <CPU>(); reciepts.orderPSU = new List <PSU>(); reciepts.orderGraphicsCard = new List <Graphics_Card>(); reciepts.orderRAM = new List <RAM>(); reciepts.orderHDD = new List <HDD>(); reciepts.orderSSD = new List <SSD>(); //Adds Case to reciepts foreach (Case c in pccase) { //stores the Case that the user chooses in the reciept reciepts.orderCase.Add(c); //dislays the name and total of the chosen Case in the rich text box rtxtList.AppendText(c.name + " | £" + c.price); } //Adds Motherboard to reciepts foreach (Motherboard m in motherboard) { //stores the Motherboard that the user chooses in the reciept reciepts.orderMotherboard.Add(m); //dislays the name and total of the chosen Motherbaord in the rich text box rtxtList.AppendText(Environment.NewLine + m.name + " | £" + m.price); } //Adds CPU to reciepts foreach (CPU cu in cpu) { //stores the CPU that the user chooses in the reciept reciepts.orderCPU.Add(cu); //dislays the name and total of the chosen CPU in the rich text box rtxtList.AppendText(Environment.NewLine + cu.name + " | £" + cu.price); } //Adds PSU to reciepts foreach (PSU p in psu) { //stores the PSU that the user chooses in the reciept reciepts.orderPSU.Add(p); //dislays the name and total of the chosen PSU in the rich text box rtxtList.AppendText(Environment.NewLine + p.name + " | £" + p.price); } //Adds Graphics Card to reciepts foreach (Graphics_Card gc in graphics_card) { //stores the Graphics Card that the user chooses in the reciept reciepts.orderGraphicsCard.Add(gc); //dislays the name and total of the chosen Grahics Card in the rich text box rtxtList.AppendText(Environment.NewLine + gc.name + " | £" + gc.price); } //Adds RAM to reciepts foreach (RAM r in ram) { //stores the RAM that the user chooses in the reciept reciepts.orderRAM.Add(r); //dislays the name and total of the chosen RAM in the rich text box rtxtList.AppendText(Environment.NewLine + r.name + " | £" + r.price); } //Adds HDD to reciepts foreach (HDD h in hdd) { //creates a double variable the stores the price of the HHD double hddtotal = h.price; //stores the HDD that the user chooses in the reciept reciepts.orderHDD.Add(h); //dislays the name, total and quantity of the chosen HDD in the rich text box rtxtList.AppendText(Environment.NewLine + h.name + " | £" + hddtotal + " | " + h.quantity); } //Adds SSD to reciepts foreach (SSD ss in ssd) { //creates a double variable the stores the price of the SSD double ssdtotal = ss.price; //stores the SSD that the user chooses in the reciept reciepts.orderSSD.Add(ss); //dislays the name, total and quantity of the chosen SSD in the rich text box rtxtList.AppendText(Environment.NewLine + ss.name + " | £" + ssdtotal + " | " + ss.quantity); } //Creates a new line and adds the text in the richtextbox rtxtList.AppendText(Environment.NewLine + "------------------------Total------------------------"); //Calls the CalcTotal function when the orderCost is required in the reciept reciepts.orderCost = CalcTotal(); //Creates a new line in the full parts richtextbox and displays the order total before payment options are selected rtxtList.AppendText(Environment.NewLine + "£" + reciepts.orderCost); //Adds all componets selected to the reciept list reciept.Add(reciepts); }
public HttpResponseMessage UpdateReciept(Guid ID, Reciept reciept) { var response = Request.CreateResponse<Reciept>(HttpStatusCode.NoContent, reciept); return response; }
public Reciept AddReciept(Reciept receipt) { context.Reciepts.Add(receipt); context.SaveChanges(); return receipt; }
private void createReciept(Reciept reciept) { File.WriteAllText(".\\reciept.json", JsonConvert.SerializeObject(reciept)); }
byte[] RecieptFontA() { var lineA = new string('-', FontAColumn).ToBytes(); Reciept = Reciept.Add( Fiş.Firma.Bitmap.Getlogo(ImageMultiplier), SelectPrintMode(PrintMode.EmphasizedOn), SelectJustification(Justification.Center), LF, string.Join("\n", Wrap(Fiş.Firma.Ünvan, FontAColumn)).ToBytes(), SelectPrintMode(PrintMode.Reset), LF, string.Join("\n", Wrap(Fiş.Firma.Adress, FontAColumn)).ToBytes(), LF, string.Join("\n", Wrap(Fiş.Firma.Tel, FontAColumn)).ToBytes(), LF, lineA, LF, SelectPrintMode(PrintMode.EmphasizedOn), PrintBarCode(BarCodeType.CODE128, Fiş.Firma.Barcode, 54), Fiş.Firma.Barcode.ToBytes(), LF, lineA, LF, SelectJustification(Justification.Left), "Müşteri Bilgileri".ToBytes(), LF, SelectPrintMode(PrintMode.Reset), string.Join("\n", Wrap($"Adı Soyadı:{Fiş.Müşter.AdSoyad}", FontAColumn)).ToBytes(), LF, string.Join("\n", Wrap($"Telefon :{Fiş.Müşter.Tel}", FontAColumn)).ToBytes(), LF, string.Join("\n", Wrap($"Adres :{Fiş.Müşter.Adress}", FontAColumn)).ToBytes(), LF, lineA, LF, SelectPrintMode(PrintMode.EmphasizedOn), "Ziyaret Bilgileri".ToBytes(), LF, SelectPrintMode(PrintMode.Reset), string.Join("\n", Wrap($"İşlem / Teslim Tarihi:{Fiş.Ziyaret.TeslimTarihi}", FontAColumn)).ToBytes(), LF, string.Join("\n", Wrap($"İşlem Bitiş Zamanı :{Fiş.Ziyaret.BitişZamanı}", FontAColumn)).ToBytes(), LF, lineA, LF, SelectPrintMode(PrintMode.EmphasizedOn), "Müşteri Şikayeti".ToBytes(), LF, SelectPrintMode(PrintMode.Reset), string.Join("\n", Wrap($"{Fiş.Müşter.Şikayet}", FontAColumn)).ToBytes(), LF, lineA, LF, SelectPrintMode(PrintMode.EmphasizedOn), "Ürün Bilgileri".ToBytes(), LF, SelectPrintMode(PrintMode.Reset), string.Join("\n", Fiş.Ürün.ÜrünBilgileri .Select(x => string.Format("{0}\n", string.Join("\n", Wrap(x, FontAColumn)))).ToArray()).ToBytes(), LF, lineA, LF, SelectPrintMode(PrintMode.EmphasizedOn), "Ücret Bilgileri".ToBytes(), LF, LF, SelectPrintMode(PrintMode.Reset), string.Join("\n", Fiş.Ücret.Bilgiler.Select(x => string.Format("{0,-19}{1,10:N2} TL\n", x.Servis, x.Fiyat)).ToArray()).ToBytes(), LF, SelectPrintMode(PrintMode.EmphasizedOn), SelectJustification(Justification.Right), "Toplam".ToBytes(), LF, string.Format("{0:N2} TL", Fiş.Ücret.Bilgiler.Sum(x => x.Fiyat)).ToBytes(), LF, lineA, LF, SelectJustification(Justification.Left), "Teknisyen Adı ve İmzası".ToBytes(), LF, SelectPrintMode(PrintMode.Reset), string.Join("\n", Wrap($"{Fiş.Teknisyen.AdSoyad}", FontAColumn)).ToBytes(), LF, Fiş.Teknisyen.Bitmap.Getlogo(ImageMultiplier), LF, lineA, LF, SelectPrintMode(PrintMode.EmphasizedOn), "Müşteri Adı ve İmzası".ToBytes(), LF, SelectPrintMode(PrintMode.Reset), string.Join("\n", Wrap($"{Fiş.Müşter.AdSoyad}", FontAColumn)).ToBytes(), LF, Fiş.Müşter.Bitmap.Getlogo(ImageMultiplier), LF, lineA, LF, LF, SelectJustification(Justification.Center), string.Join("\n", Wrap(Fiş.Firma.Adress, FontAColumn)).ToBytes(), LF, string.Join("\n", Wrap(Fiş.Firma.Tel, FontAColumn)).ToBytes(), LF, PrintQRCode(Fiş.Firma.Barcode, QRCodeModel.Model2, QRCodeCorrection.Percent30, QRCodeSize.Large), LF, CarriageReturn, CarriageReturn, CarriageReturn ); return(Reciept); }