コード例 #1
0
        internal MatrixMemberCollection(Matrix owner, MatrixMember parent, MatrixHeading headingDef, MatrixHeadingInstanceList headingInstances, List <int> memberMapping, bool isParentSubTotal)
        {
            m_owner            = owner;
            m_parent           = parent;
            m_headingInstances = headingInstances;
            m_headingDef       = headingDef;
            m_memberMapping    = memberMapping;
            m_isParentSubTotal = isParentSubTotal;
            if (!owner.NoRows)
            {
                return;
            }
            Subtotal subtotal = m_headingDef.Subtotal;

            if (subtotal != null)
            {
                if (subtotal.Position == Subtotal.PositionType.After)
                {
                    m_subTotalPosition = 1;
                }
                else
                {
                    m_subTotalPosition = 0;
                }
            }
        }
コード例 #2
0
 //[/BARCODE FUNCTIONS]
 private void UpdateCash()
 {
     SubtotalTemp = 0; TaxTemp = 0; Subtotal = 0; TotalTax = 0;
     if (!semaphore && !OnExit)
     {
         semaphore = true;
         foreach (DataGridViewRow r in TeldgView.Rows)
         {
             if (!r.IsNewRow && !OnExit)
             {
                 try
                 {   //PriceLevelSelection
                     DataRow aItemRow = ItemsMgmt.SelectItemRowByBarcode(TeldgView.Rows[r.Index].Cells["Barcode"].Value.ToString());
                     SubtotalTemp = Math.Round(double.Parse(TeldgView.Rows[r.Index].Cells["PriceTotal"].Value.ToString()), 3);
                     Subtotal    += SubtotalTemp;
                     TaxTemp      = double.Parse(TeldgView.Rows[r.Index].Cells["Tax"].Value.ToString());
                     TotalTax    += (TaxTemp / 100) * SubtotalTemp; //Net amount = (Selling Price - Sales Price)*Tax
                     //updates
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show("UPDATE CASH ERROR IN [DISPOSE ITEMS] Exception:" + ex.ToString());
                     return;
                 }
             }
         }
         TotalTxtBox.Text    = Math.Round(Subtotal + TotalTax, 2).ToString();
         Subtotal            = Math.Round(Subtotal, 2);
         SubtotalTxtBox.Text = Subtotal.ToString();
         TotalTax            = Math.Round(TotalTax, 3);
         TaxTxtBox.Text      = TotalTax.ToString();
         semaphore           = false;
     }
 }
コード例 #3
0
ファイル: SubtotalTests.cs プロジェクト: yosmanyhs/EPPlus-1
        public void ShouldThrowIfInvalidFuncNumber()
        {
            var func = new Subtotal();
            var args = FunctionsHelper.CreateArgs(139, 1);

            func.Execute(args, _context);
        }
コード例 #4
0
 void FillPrices()
 {
     FindViewById <TextView>(Resource.Id.tvSubtotal).Text  = Subtotal.ToString("C", System.Globalization.CultureInfo.GetCultureInfo("es-mx"));
     FindViewById <TextView>(Resource.Id.tvDescuento).Text = Descuento.ToString("C", System.Globalization.CultureInfo.GetCultureInfo("es-mx"));
     FindViewById <TextView>(Resource.Id.tvIVA).Text       = IVATotal.ToString("C", System.Globalization.CultureInfo.GetCultureInfo("es-mx"));
     FindViewById <TextView>(Resource.Id.tvTotal).Text     = Total.ToString("C", System.Globalization.CultureInfo.GetCultureInfo("es-mx"));
 }
コード例 #5
0
        private void CMDFACUTRA_Click(object sender, EventArgs e)
        {
            //Programa para hacer factura de automovil
            //Silva Reyes Luis Adrian 19210549
            //Tarea#12

            //Declaracion de variables
            Double Precio, Ganancia, Comision, Iva, Subtotal, Total;
            string Descripciones;

            //Asignacion de variables
            Precio        = System.Double.Parse(TXTPRE.Text);
            Descripciones = (TXTDES.Text);

            //Calculo de factura
            Ganancia = Precio * .20;
            Comision = Ganancia + 0.03;
            Subtotal = Ganancia + Precio + Comision;
            Iva      = Subtotal * .15;
            Total    = Subtotal + Iva;

            //Salida de datos
            TXTDESC.Text  = Descripciones.ToString();
            TXTSUB.Text   = Subtotal.ToString();
            TXTIVA.Text   = Iva.ToString();
            TXTTOTAL.Text = Total.ToString();
        }
コード例 #6
0
        public override string ToString()
        {
            // TODO ArBy global culture, datetime format
            var formattedIssueDate      = IssueDate.ToString("yyyy-MM-dd");
            var formattedDueDate        = DueDate.ToString("yyyy-MM-dd");
            var formattedRedemptionDate = RedemptionDate != null?RedemptionDate.Value.ToString("yyyy-MM-dd") : "n/a";

            return("Invoice(" +
                   $"serial={Serial}, " +
                   $"id={Id}, " +
                   $"isPayed={IsPayed.ToString()}, " +
                   $"issueDate={formattedIssueDate}, " +
                   $"dueDate={formattedDueDate}, " +
                   $"redemptionDate={formattedRedemptionDate}, " +
                   $"supplier={Supplier}, " +
                   $"receiver={Receiver}, " +
                   $"total={Total.ToString(CultureInfo.InvariantCulture)}, " +
                   $"subtotal={Subtotal.ToString(CultureInfo.InvariantCulture)}, " +
                   $"discount={Discount.ToString(CultureInfo.InvariantCulture)}, " +
                   $"payed={Payed.ToString(CultureInfo.InvariantCulture)}, " +
                   $"due={Due.ToString(CultureInfo.InvariantCulture)}, " +
                   $"items=[{string.Join(", ", Items)}], " +
                   $"payments=[{string.Join(", ", Payments)}]" +
                   ")");
        }
コード例 #7
0
        /// <summary>
        /// Prints receipt
        /// </summary>
        /// <param name="pay"> number that represents the method of payment</param>
        private void Receipt(int pay)
        {
            ReceiptPrinter r  = new ReceiptPrinter();
            StringBuilder  sb = new StringBuilder();

            sb.Append("\t                   Cowboy Cafe\n    _________________________________________\n\nOrder #" + OrderNumber.ToString() + "\t\t\t" + DateTime.Now + "\n\n");
            foreach (IOrderItem i in Items)
            {
                sb.Append(i.ToString() + "\t\t " + i.Price.ToString("C2"));
                foreach (string st in i.SpecialInstructions)
                {
                    sb.Append("\n\t" + st);
                }
                sb.Append("\n");
            }
            sb.Append("\nSubtotal: " + Subtotal.ToString("C2") + "\nTax: \t " + Tax.ToString("C2") + "\nTotal:  \t " + Total.ToString("C2") + "\n");
            if (pay == 0)
            {
                sb.Append("\nPaid: \t" + Paid.ToString("C2"));
            }
            else
            {
                sb.Append("\nCredit: \t " + Paid.ToString("C2"));
            }
            sb.Append("\nChange: \t " + Change.ToString("C2"));
            string s = sb.ToString();

            MessageBox.Show(s);
            r.Print(s);
            s = "Contents of the Cash Drawer\n\n____________________________\n            Coins\n____________________________\n\nPennies: " + cd.Pennies + "\nNickels: " + cd.Nickels + "\nDimes: " + cd.Dimes + "\nQuarters: " + cd.Quarters + "\nHalf Dollars: " + cd.HalfDollars + "\nDollars: " + cd.Dollars + "\n\n____________________________\n             Bills\n____________________________\n\nOnes: " + cd.Ones + "\nTwos: " + cd.Twos + "\nFives: " + cd.Fives + "\nTens: " + cd.Tens + "\nTwenties: " + cd.Twenties + "\nFifties: " + cd.Fifties + "\nHundreds: " + cd.Hundreds + "\n\n____________________________\nCash Drawer Total: " + cd.TotalValue.ToString("C2") + "\n____________________________\n";
            MessageBox.Show(s);
            NewOrder();
        }
コード例 #8
0
        private void Process(IXLRange root, GroupTag[] groups, bool summaryAbove, SubtotalSummaryFunc[] funcs, bool disableGrandTotal)
        {
            var groupRow = root.LastRow();
            //   DoGroups

            var level = 0;
            var r     = root.Offset(0, 0, root.RowCount() - 1, root.ColumnCount());

            using (var subtotal = new Subtotal(r, summaryAbove))
            {
                if (TotalLabel != null)
                {
                    subtotal.TotalLabel = TotalLabel;
                }
                if (GrandLabel != null)
                {
                    subtotal.GrandLabel = GrandLabel;
                }
                if (!disableGrandTotal)
                {
                    var total = subtotal.AddGrandTotal(funcs);
                    total.SummaryRow.Cell(2).Value = total.SummaryRow.Cell(1).Value;
                    total.SummaryRow.Cell(1).Value = null;
                    level++;
                }

                foreach (var g in groups.OrderBy(x => x.Column))
                {
                    Func <string, string> labFormat = null;
                    if (!string.IsNullOrEmpty(g.LabelFormat))
                    {
                        labFormat = title => string.Format(LabelFormat, title);
                    }

                    subtotal.GroupBy(g.Column, g.DisableSubtotals ? new SubtotalSummaryFunc[0] : funcs, g.PageBreaks, labFormat);

                    g.Level = ++level;
                }
                foreach (var g in groups.Where(x => x.IsWithHeader).OrderBy(x => x.Column))
                {
                    subtotal.AddHeaders(g.Column);
                }

                var gr = groups.Union(new[] { new GroupTag {
                                                  Column = 1, Level = 1
                                              } })
                         .ToDictionary(x => x.Level, x => x);

                foreach (var subGroup in subtotal.Groups.OrderBy(x => x.Column).Reverse())
                {
                    var groupTag = gr[subGroup.Level];
                    FormatHeaderFooter(subGroup, groupRow);

                    GroupRender(subGroup, groupTag);
                }
            }
            //   Rem DoDeleteSpecialRow
            root.LastRow().Delete(XLShiftDeletedCells.ShiftCellsUp);
        }
コード例 #9
0
ファイル: SubtotalTests.cs プロジェクト: yosmanyhs/EPPlus-1
        public void ShouldCalculateMaxWhenCalcTypeIs4()
        {
            var func   = new Subtotal();
            var args   = FunctionsHelper.CreateArgs(4, 10, 20, 30, 40, 50);
            var result = func.Execute(args, _context);

            Assert.AreEqual(50d, result.Result);
        }
コード例 #10
0
ファイル: OrderViewModel.cs プロジェクト: ShawnAndrews/POS
        /* Send order to kitchen and subsequently clear order data */
        private void DialogBoxAcceptExecute(object parameter)
        {
            POSOrder order            = new POSOrder();
            int      numOfOrderItems  = 0;
            int      iterationCounter = 0;

            // prepare order for submission to service
            for (int i = 0; i < Enum.GetNames(typeof(menuItemType)).Length; i++)
            {
                foreach (MenuItem item in menuOrderLists[i])
                {
                    numOfOrderItems++;
                }
            }
            order.menuItems = new POSMenuItem[numOfOrderItems];
            for (int i = 0; i < Enum.GetNames(typeof(menuItemType)).Length; i++)
            {
                for (int j = 0; j < menuOrderLists[i].Count; j++)
                {
                    POSMenuItem item = new POSMenuItem();
                    item.Price       = menuOrderLists[i][j].Price;
                    item.Product     = menuOrderLists[i][j].Product;
                    item.ProductType = (POSMenuItemEnum)menuOrderLists[i][j].ProductType;
                    item.Quantity    = menuOrderLists[i][j].Quantity;
                    order.menuItems[iterationCounter++] = item;
                }
            }
            order.SubTotal = float.Parse(Subtotal.Substring(1, Subtotal.Length - 1), CultureInfo.InvariantCulture.NumberFormat);
            order.Total    = float.Parse(Total.Substring(1, Total.Length - 1), CultureInfo.InvariantCulture.NumberFormat);

            // send order information to service
            eventAggregator.GetEvent <PlaceOrderEvent>().Publish(order);

            // delete all items in current order
            foreach (ObservableCollection <MenuItem> list in orderModel.menuOrderLists)
            {
                list.Clear();
            }

            // reset selected indices
            for (int i = 0; i < POSConstants.NUM_MENU_ORDER_TYPES; i++)
            {
                menuOrderListsSelectedIndex[i] = -1;
            }

            // recalculate new order price
            calcOrderPrice();

            // increment number of orders
            incrementOrder();

            // recheck order data
            removeOrderItemBtnICommand.RaiseCanExecuteChanged();

            // hide gray overlay
            takeOrderGrayOverlay = Visibility.Hidden;
            OnPropertyChanged("takeOrderGrayOverlay");
        }
コード例 #11
0
ファイル: SubtotalTests.cs プロジェクト: yosmanyhs/EPPlus-1
        public void ShouldCalculateStdevPWhenCalcTypeIs108()
        {
            var func          = new Subtotal();
            var args          = FunctionsHelper.CreateArgs(108, 10, 20, 30, 40, 50);
            var result        = func.Execute(args, _context);
            var resultRounded = Math.Round((double)result.Result, 8);

            Assert.AreEqual(14.14213562, resultRounded);
        }
コード例 #12
0
ファイル: SubtotalTests.cs プロジェクト: yosmanyhs/EPPlus-1
        public void ShouldCalculateStdevWhenCalcTypeIs7()
        {
            var func          = new Subtotal();
            var args          = FunctionsHelper.CreateArgs(7, 10, 20, 30, 40, 50);
            var result        = func.Execute(args, _context);
            var resultRounded = Math.Round((double)result.Result, 5);

            Assert.AreEqual(15.81139d, resultRounded);
        }
コード例 #13
0
        public void ScanForGroupsTest()
        {
            void AssertGroup(SubtotalGroup group, string expectedAddress, string expectedTitle)
            {
                group.Range.RangeAddress.ToString().Should().Be(expectedAddress);
                group.Level.Should().Be(1);
                group.GroupTitle.Should().Be(expectedTitle);
            }

            _workbook = new XLWorkbook();
            var sheet = _workbook.AddWorksheet("test");

            sheet.Range("A2:A5").Value   = "val1";
            sheet.Range("A6:A9").Value   = "val2";
            sheet.Range("A10:A13").Value = "val3";

            sheet.Range("B2:B4").Value   = "val4";
            sheet.Range("B5:B11").Value  = "val5";
            sheet.Range("B12:B13").Value = "val6";

            sheet.Range("C2:C3").Value   = "val7";
            sheet.Range("C4:C6").Value   = "val8";
            sheet.Range("C7:C8").Value   = "val9";
            sheet.Range("C9:C12").Value  = "val7";
            sheet.Range("C13:C13").Value = "val8";

            _rng = sheet.Range("A2:C13");

            using (var subtotal = new Subtotal(_rng))
            {
                var groups = subtotal.ScanForGroups(1);
                groups.Length.Should().Be(3);
                AssertGroup(groups[0], "A2:C5", "val1");
                AssertGroup(groups[1], "A6:C9", "val2");
                AssertGroup(groups[2], "A10:C13", "val3");

                groups = subtotal.ScanForGroups(2);
                groups.Length.Should().Be(5);
                AssertGroup(groups[0], "A2:C4", "val4");
                AssertGroup(groups[1], "A5:C5", "val5");
                AssertGroup(groups[2], "A6:C9", "val5");
                AssertGroup(groups[3], "A10:C11", "val5");
                AssertGroup(groups[4], "A12:C13", "val6");

                groups = subtotal.ScanForGroups(3);
                groups.Length.Should().Be(9);
                AssertGroup(groups[0], "A2:C3", "val7");
                AssertGroup(groups[1], "A4:C4", "val8");
                AssertGroup(groups[2], "A5:C5", "val8");
                AssertGroup(groups[3], "A6:C6", "val8");
                AssertGroup(groups[4], "A7:C8", "val9");
                AssertGroup(groups[5], "A9:C9", "val7");
                AssertGroup(groups[6], "A10:C11", "val7");
                AssertGroup(groups[7], "A12:C12", "val7");
                AssertGroup(groups[8], "A13:C13", "val8");
            }
        }
コード例 #14
0
        public void SubtotalWithInvalidArgumentReturnsPoundValue()
        {
            var func           = new Subtotal();
            var parsingContext = ParsingContext.Create();
            var args           = FunctionsHelper.CreateArgs();
            var result         = func.Execute(args, parsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type);
        }
コード例 #15
0
ファイル: Order.cs プロジェクト: kris-dyke/sharpdash
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Consumer != null)
         {
             hashCode = hashCode * 59 + Consumer.GetHashCode();
         }
         if (Store != null)
         {
             hashCode = hashCode * 59 + Store.GetHashCode();
         }
         if (Subtotal != null)
         {
             hashCode = hashCode * 59 + Subtotal.GetHashCode();
         }
         if (Tax != null)
         {
             hashCode = hashCode * 59 + Tax.GetHashCode();
         }
         if (EstimatedPickupTime != null)
         {
             hashCode = hashCode * 59 + EstimatedPickupTime.GetHashCode();
         }
         if (IsPickup != null)
         {
             hashCode = hashCode * 59 + IsPickup.GetHashCode();
         }
         if (Categories != null)
         {
             hashCode = hashCode * 59 + Categories.GetHashCode();
         }
         if (IsTaxRemittedByDoordash != null)
         {
             hashCode = hashCode * 59 + IsTaxRemittedByDoordash.GetHashCode();
         }
         if (TaxAmountRemittedByDoordash != null)
         {
             hashCode = hashCode * 59 + TaxAmountRemittedByDoordash.GetHashCode();
         }
         if (CommissionType != null)
         {
             hashCode = hashCode * 59 + CommissionType.GetHashCode();
         }
         if (DeliveryShortCode != null)
         {
             hashCode = hashCode * 59 + DeliveryShortCode.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #16
0
ファイル: SubtotalTests.cs プロジェクト: yosmanyhs/EPPlus-1
        public void ShouldCalculateVarWhenCalcTypeIs110()
        {
            var func = new Subtotal();
            var args = FunctionsHelper.CreateArgs(110, 10, 20, 30, 40, 50, 51);

            args.Last().SetExcelStateFlag(ExcelCellState.HiddenCell);
            var result = func.Execute(args, _context);

            Assert.AreEqual(250d, result.Result);
        }
コード例 #17
0
 public void WithHeaders()
 {
     LoadTemplate("91_plaindata.xlsx");
     using (var subtotal = new Subtotal(_rng))
     {
         var summaries = new [] { new SubtotalSummaryFunc("sum", 7), };
         subtotal.AddGrandTotal(summaries);
         subtotal.GroupBy(2, summaries, true);
         subtotal.GroupBy(3, summaries, true);
         subtotal.AddHeaders(2);
         subtotal.AddHeaders(3);
     }
     CompareWithGauge(_workbook, "Subtotal_WithHeaders.xlsx");
 }
コード例 #18
0
ファイル: clsPedidos.cs プロジェクト: gabrielveg/CSharp7
        public override string ToString()
        {
            string cadena = "";

            cadena += Cliente.ToString() + "\n";
            cadena += "Pedido: " + Folio.ToString() + " Subtotal: " + Subtotal.ToString("C") +
                      " Iva: " + MontoIva.ToString("C") + " MontoIeps: " + MontoIeps.ToString("C") +
                      " Total: " + Total.ToString("C") + "\n\n";
            foreach (clsProductosPedido item in Items)
            {
                cadena += item.ToString();
            }
            return(cadena);
        }
コード例 #19
0
 public void Update(Subtotal pEvent)
 {
     this.Clear();
     if (this.prompt != null)
     {
         prompt.PromptText = pEvent.PromptText + "\n" + string.Format(new PosTextFormatter(), "{0:Money}", string.Format("{0:#########.00}", pEvent.Amount));
     }
     if (PosHardware.Instance.LineDisplay != null)
     {
         PosHardware.Instance.LineDisplay.Clear();
         PosHardware.Instance.LineDisplay.SetText(pEvent.PromptText, 0, 0);
         PosHardware.Instance.LineDisplay.SetText(string.Format("{0:#########.00}", pEvent.Amount), 1, 0);
     }
 }
コード例 #20
0
        private void button2_Click(object sender, EventArgs e)
        {
            Supplier.Clear();
            SPhone.Clear();


            DateTime iDate = DateTime.Now;

            OrderTime.Clear();


            Subtotal.Clear();
            TaxtxtBox.Clear();
            total.Clear();
        }
コード例 #21
0
        public override void WriteXml(ref IaXmlWriter xml)
        {
            xml.WriteStartElement("function");
            xml.WriteAttribute("controlid", ControlId, true);

            xml.WriteStartElement("create_ictransaction");

            xml.WriteElement("transactiontype", TransactionDefinition, true);

            xml.WriteStartElement("datecreated");
            xml.WriteDateSplitElements(TransactionDate.Value, true);
            xml.WriteEndElement(); //datecreated

            xml.WriteElement("createdfrom", CreatedFrom);
            xml.WriteElement("documentno", DocumentNumber);
            xml.WriteElement("referenceno", ReferenceNumber);
            xml.WriteElement("message", Message);
            xml.WriteElement("externalid", ExternalId);
            xml.WriteElement("basecurr", BaseCurrency);

            xml.WriteCustomFieldsExplicit(CustomFields);

            xml.WriteElement("state", State);

            xml.WriteStartElement("ictransitems");
            if (Lines.Count > 0)
            {
                foreach (InventoryTransactionLineCreate Line in Lines)
                {
                    Line.WriteXml(ref xml);
                }
            }
            xml.WriteEndElement(); //ictransitems

            if (Subtotals.Count > 0)
            {
                xml.WriteStartElement("subtotals");
                foreach (TransactionSubtotalCreate Subtotal in Subtotals)
                {
                    Subtotal.WriteXml(ref xml);
                }
                xml.WriteEndElement(); //subtotals
            }

            xml.WriteEndElement(); //create_ictransaction

            xml.WriteEndElement(); //function
        }
コード例 #22
0
 public SeatPlan(PlayInfoForm upperForm)
 {
     InitializeComponent();
     UpperForm     = upperForm;
     Subtotal      = 0.0;
     label10.Text  = Subtotal.ToString("C", CultureInfo.CreateSpecificCulture("en-GB"));
     SelectedSeats = new List <Seat>();
     foreach (Control p in panel1.Controls)//get all flowlaylout panels in panel1
     {
         //check if flow layout panel
         if (p.GetType() == typeof(FlowLayoutPanel))
         {
             foreach (Control b in p.Controls)//for each button a single flowlayoutpanel
             {
                 foreach (Band band in UpperForm.ChosenPerformance.PerformanceBands)
                 {
                     Band   currentBand = band;
                     double price       = currentBand.BandPrice;
                     string letter      = currentBand.BandNumber;
                     foreach (Seat seat in band.BandSeats)
                     {
                         string number   = seat.SeatNumber.ToString();
                         bool   occupied = seat.Occupied;
                         if (b.Name == letter + number)
                         {
                             if (occupied == true)
                             {
                                 b.BackColor = Color.Red;
                                 b.Text      = letter + number;
                                 b.Enabled   = false;
                             }
                             else
                             {
                                 b.BackColor = Color.Gray;
                                 b.Text      = price.ToString("C", CultureInfo.CreateSpecificCulture("en-GB"))
                                               + "\n" + letter + number;
                                 b.Click  += MyButtonClick;
                                 b.Enabled = true;
                             }
                         }
                     }
                 }
             }
         }
     }
     this.Show();
 }
コード例 #23
0
ファイル: TestSubtotal.cs プロジェクト: yesonsik/npoi
        private static void ConfirmSubtotal(int function, double expected)
        {
            ValueEval[] values = new ValueEval[TEST_VALUES0.Length];
            for (int i = 0; i < TEST_VALUES0.Length; i++)
            {
                values[i] = new NumberEval(TEST_VALUES0[i]);
            }

            AreaEval arg1 = EvalFactory.CreateAreaEval("C1:D5", values);

            ValueEval[] args = { new NumberEval(function), arg1 };

            ValueEval result = new Subtotal().Evaluate(args, 0, 0);

            Assert.AreEqual(typeof(NumberEval), result.GetType());
            Assert.AreEqual(expected, ((NumberEval)result).NumberValue, 0.0);
        }
コード例 #24
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Product != null ? Product.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Quantity.GetHashCode();
         hashCode = (hashCode * 397) ^ Rate.GetHashCode();
         hashCode = (hashCode * 397) ^ TaxPercentage.GetHashCode();
         hashCode = (hashCode * 397) ^ DiscountPercentage.GetHashCode();
         hashCode = (hashCode * 397) ^ Total.GetHashCode();
         hashCode = (hashCode * 397) ^ Subtotal.GetHashCode();
         hashCode = (hashCode * 397) ^ Tax.GetHashCode();
         hashCode = (hashCode * 397) ^ LineIdx;
         return(hashCode);
     }
 }
コード例 #25
0
		Visibility _Visibility;	// Indicates if all of the dynamic rows for this grouping
							// should be hidden and replaced with a subtotal row for
							// this grouping scope		

		public DynamicRows(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p)
		{
			_Grouping=null;
			_Sorting=null;
			_Subtotal=null;
			_ReportItems=null;
			_Visibility=null;
			// Run thru the attributes
			//			foreach(XmlAttribute xAttr in xNode.Attributes)
			//			{
			//			}

			// Loop thru all the child nodes
			foreach(XmlNode xNodeLoop in xNode.ChildNodes)
			{
				if (xNodeLoop.NodeType != XmlNodeType.Element)
					continue;
				switch (xNodeLoop.Name)
				{
					case "Grouping":
						_Grouping = new Grouping(r, this, xNodeLoop);
						break;
					case "Sorting":
						_Sorting = new Sorting(r, this, xNodeLoop);
						break;
					case "Subtotal":
						_Subtotal = new Subtotal(r, this, xNodeLoop);
						break;
					case "ReportItems":
						_ReportItems = new ReportItems(r, this, xNodeLoop);
						break;
					case "Visibility":
						_Visibility = new Visibility(r, this, xNodeLoop);
						break;
					default:	
						// don't know this element - log it
						OwnerReport.rl.LogError(4, "Unknown DynamicRow element '" + xNodeLoop.Name + "' ignored.");
						break;
				}
			}
			if (_Grouping == null)
				OwnerReport.rl.LogError(8, "DynamicRows requires the Grouping element.");
			if (_ReportItems == null || _ReportItems.Items.Count != 1)
				OwnerReport.rl.LogError(8, "DynamicRows requires the ReportItems element defined with exactly one report item.");
		}
コード例 #26
0
        /// <summary>
        /// Creates the reciept to be sent to the printer
        /// </summary>
        /// <param name="cardOrCash">0 if card 1 if cash</param>
        private void PrintReceipt(int cardOrCash)
        {
            ReceiptPrinter rp = new ReceiptPrinter();
            StringBuilder  sb = new StringBuilder();

            sb.Append("---------- COWBOY CAFE ----------\n");
            sb.Append(DateTime.Now + "\n");
            sb.Append("Order #: " + PrevOrderNumber + "\n");

            /* Iterate over all items */
            foreach (IOrderItem i in Items)
            {
                sb.Append(i.ToString() + "\t\t" + i.Price.ToString("C2") + "\n");

                /* Iterate through the special instruction for the item i */
                foreach (string s in i.SpecialInstructions)
                {
                    sb.Append(s + "\n");
                }

                sb.Append("\n");
            }

            sb.Append("Subtotal: " + Subtotal.ToString("C2") + "\n");
            sb.Append("Tax: " + Tax.ToString("C2") + "\n");
            sb.Append("Total: " + TotalWithTax.ToString("C2") + "\n\n");

            if (cardOrCash == 1)
            {
                sb.Append("Paid: " + Paid.ToString("C2") + "\n");
                sb.Append("Change: " + Change.ToString("C2") + "\n");
            }
            else
            {
                sb.Append("Credit Card was used!\n");
            }

            string sr = sb.ToString();

            MessageBox.Show(sr);
            rp.Print(sr);
            ShowDrawerContents();
            SetNewOrder();
        }
コード例 #27
0
 private void DgvListado_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         DgvMostrarDetalle.DataSource = NVenta.ListarDetalle(Convert.ToInt32(DgvListado.CurrentRow.Cells["ID"].Value));
         decimal Total, Subtotal;
         decimal Impuesto = Convert.ToDecimal(DgvListado.CurrentRow.Cells["Impuesto"].Value);
         Total                = Convert.ToDecimal(DgvListado.CurrentRow.Cells["Total"].Value);
         Subtotal             = Total / (1 + Impuesto);
         TxtSubDetalle.Text   = Subtotal.ToString("#0.00#");
         TxtImDetalle.Text    = (Total - Subtotal).ToString("#0.00#");
         TxtTotDetalle.Text   = Total.ToString("#0.00#");
         PanelMostrar.Visible = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #28
0
        public void ScanForGroupsTest()
        {
            LoadTemplate("9_plaindata.xlsx");

            SubtotalGroup[] groups;
            using (var subtotal = new Subtotal(_rng))
                groups = subtotal.ScanForGroups(2);

            groups.Length.Should().Be(3);
            groups[0].Range.RangeAddress.ToString().Should().Be("C3:I26");
            groups[0].Level.Should().Be(1);
            groups[0].GroupTitle.Should().Be("Central");
            groups[1].Range.RangeAddress.ToString().Should().Be("C27:I38");
            groups[1].Level.Should().Be(1);
            groups[1].GroupTitle.Should().Be("East");
            groups[2].Range.RangeAddress.ToString().Should().Be("C39:I44");
            groups[2].Level.Should().Be(1);
            groups[2].GroupTitle.Should().Be("West");
        }
コード例 #29
0
 private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         dgvMostarDetalle.DataSource = N_Factura.ListarDetalle(Convert.ToInt32(dataGridView1.CurrentRow.Cells["ID"].Value));
         decimal Total, Subtotal;
         decimal Impuesto = Convert.ToDecimal(dataGridView1.CurrentRow.Cells["Impuesto"].Value);
         Total    = Convert.ToDecimal(dataGridView1.CurrentRow.Cells["Total"].Value);
         Subtotal = Total / Impuesto;
         txtSubTotalDetalle.Text = Subtotal.ToString("#0.00#");
         txtTotalDetalle.Text    = Total.ToString("#0.00#");
         txtIVADetalle.Text      = (Total - Subtotal).ToString("#0.00#");
         panelDetalleDoc.Visible = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #30
0
        public int CompareTo(Invoice other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            if (ReferenceEquals(null, other))
            {
                return(1);
            }
            var serialNumberComparison = string.Compare(SerialNumber, other.SerialNumber, StringComparison.Ordinal);

            if (serialNumberComparison != 0)
            {
                return(serialNumberComparison);
            }
            var companyNameComparison = string.Compare(CompanyName, other.CompanyName, StringComparison.Ordinal);

            if (companyNameComparison != 0)
            {
                return(companyNameComparison);
            }
            var subtotalComparison = Subtotal.CompareTo(other.Subtotal);

            if (subtotalComparison != 0)
            {
                return(subtotalComparison);
            }
            var departmentComparison = Department.CompareTo(other.Department);

            if (departmentComparison != 0)
            {
                return(departmentComparison);
            }
            var issueDateComparison = IssueDate.CompareTo(other.IssueDate);

            if (issueDateComparison != 0)
            {
                return(issueDateComparison);
            }
            return(DueDate.CompareTo(other.DueDate));
        }
コード例 #31
0
        private bool Equals(IInvoice other)
        {
            if (!(InvoiceId == other.InvoiceId && InvoiceNumber == other.InvoiceNumber && InvoiceNumberAsString == other.InvoiceNumberAsString && Total.Equals(other.Total) &&
                  Subtotal.Equals(other.Subtotal) && Nullable.Equals(Tax, other.Tax) && Nullable.Equals(TaxPercentage, other.TaxPercentage) && InvoiceDate.Equals(other.InvoiceDate) &&
                  ContractName == other.ContractName && PeriodStartDate.Equals(other.PeriodStartDate) && PeriodEndDate.Equals(other.PeriodEndDate) && Currency == other.Currency &&
                  Equals(From, other.From) && Equals(To, other.To)))
            {
                return(false);
            }

            if (LineItems is null && other.LineItems is null)
            {
                return(true);
            }
            if (LineItems is null || other.LineItems is null)
            {
                return(false);
            }
            return(LineItems.OrderBy(x => x.LineIdx).SequenceEqual(other.LineItems.OrderBy(x => x.LineIdx)));
        }