Example #1
0
 public bool SendInvoice(bool closed, bool print)
 {
     smartRestaurant.CheckBillService.CheckBillService service = new smartRestaurant.CheckBillService.CheckBillService();
     Invoice invoice = this.CreateInvoice();
     if (!closed)
     {
         invoice.totalReceive = 0.0;
     }
     string s = service.SendInvoice(invoice);
     try
     {
         this.invoiceID = int.Parse(s);
     }
     catch (Exception)
     {
         MessageBox.Show(s);
         return true;
     }
     if (!closed && (this.invoiceID == -1))
     {
         return false;
     }
     if (print)
     {
         smartRestaurant.OrderService.OrderService service2 = new smartRestaurant.OrderService.OrderService();
         if (closed)
         {
             service2.PrintBill(invoice.orderBillID);
         }
         else
         {
             service2.PrintReceipt(invoice.orderBillID);
         }
     }
     if (this.invoiceID == -1)
     {
         return false;
     }
     return true;
 }
Example #2
0
 private void LoadInvoice()
 {
     Invoice invoiceByID;
     smartRestaurant.CheckBillService.CheckBillService service = new smartRestaurant.CheckBillService.CheckBillService();
     if (this.invoiceID == 0)
     {
         invoiceByID = service.GetInvoice(this.selectedBill.OrderBillID);
     }
     else
     {
         invoiceByID = service.GetInvoiceByID(this.invoiceID);
     }
     if (invoiceByID == null)
     {
         this.SendInvoice(false, false);
     }
     else if (invoiceByID.invoiceID == 0)
     {
         MessageBox.Show("Can't load invoice data");
     }
     else
     {
         this.invoiceID = invoiceByID.invoiceID;
         this.invoiceNote = invoiceByID.invoiceNote;
         this.paymentMethod = null;
         if (PaymentMethods != null)
         {
             for (int i = 0; i < PaymentMethods.Length; i++)
             {
                 if (PaymentMethods[i].paymentMethodID == invoiceByID.paymentMethodID)
                 {
                     this.paymentMethod = PaymentMethods[i];
                     break;
                 }
             }
         }
         if (this.selectedBill == null)
         {
             this.employeeID = invoiceByID.employeeID;
             this.orderBillID = invoiceByID.orderBillID;
         }
         this.amountDue = invoiceByID.totalPrice;
         this.pointAmount = invoiceByID.point;
         this.tax1 = invoiceByID.tax1;
         this.tax2 = invoiceByID.tax2;
         this.totalDiscount = invoiceByID.totalDiscount;
         this.totalReceive = invoiceByID.totalReceive;
         this.totalDue = ((this.amountDue + this.tax1) + this.tax2) - this.totalDiscount;
         this.useDiscount.Clear();
         if (invoiceByID.discounts != null)
         {
             for (int j = 0; j < invoiceByID.discounts.Length; j++)
             {
                 for (int k = 0; k < Discounts.Length; k++)
                 {
                     if (Discounts[k].promotionID == invoiceByID.discounts[j].promotionID)
                     {
                         this.useDiscount.Add(Discounts[k]);
                         break;
                     }
                 }
             }
         }
         this.paymentMethodList.Clear();
         this.payValueList.Clear();
         if (invoiceByID.payments != null)
         {
             for (int m = 0; m < invoiceByID.payments.Length; m++)
             {
                 for (int n = 0; n < PaymentMethods.Length; n++)
                 {
                     if (PaymentMethods[n].paymentMethodID == invoiceByID.payments[m].paymentMethodID)
                     {
                         this.paymentMethodList.Add(PaymentMethods[n]);
                         this.payValueList.Add(invoiceByID.payments[m].receive);
                         break;
                     }
                 }
             }
         }
     }
 }
Example #3
0
 public void Compute()
 {
     this.totalDue = 0.0;
     double num = 0.0;
     double num2 = 0.0;
     if (this.useDiscount.Count > 0)
     {
         for (int j = 0; j < this.useDiscount.Count; j++)
         {
             Discount discount = (Discount) this.useDiscount[j];
             if (discount.discountPercent > 0.0)
             {
                 num2 += discount.discountPercent;
             }
             else if (discount.discountAmount > 0.0)
             {
                 num += discount.discountAmount;
             }
         }
     }
     if ((this.selectedBill != null) && (this.selectedBill.Items != null))
     {
         BillPrice computeBillPrice = new smartRestaurant.CheckBillService.CheckBillService().GetComputeBillPrice(this.selectedBill.OrderBillID);
         this.amountDue = computeBillPrice.totalPrice;
         this.totalDiscount = computeBillPrice.totalDiscount;
         this.tax1 = computeBillPrice.totalTax1;
         this.tax2 = computeBillPrice.totalTax2;
     }
     else if (this.selectedBill != null)
     {
         this.totalDiscount = num;
         this.amountDue = this.tax1 = this.tax2 = 0.0;
     }
     this.totalDue = ((this.amountDue - this.totalDiscount) + this.tax1) + this.tax2;
     double num4 = 0.0;
     for (int i = 0; i < this.payValueList.Count; i++)
     {
         num4 += (double) this.payValueList[i];
     }
     this.totalReceive = ((num4 + this.PointValue) + this.CouponValue) + this.GiftVoucherValue;
     if (this.totalDue < 0.0)
     {
         this.totalDue = 0.0;
     }
     this.change = this.totalReceive - this.totalDue;
     if (this.change < 0.0)
     {
         this.change = 0.0;
     }
 }