Example #1
0
        private int createInvoiceTotals(InvoiceDS.InvoiceTotalTableRow total, int row0)
        {
            //Get worksheet
            int     _rows   = 0;
            Invoice invoice = global::Argix.Finance.Globals.Invoice;

            //Header
            _rows += 4;
            Excel.Range r = invoice.get_Range(invoice.Cells[row0 + 1, 1], invoice.Cells[row0 + 1, 12]);
            r.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeTop].Color          = Color.Black.ToArgb();
            invoice.get_Range(invoice.Cells[row0 + 1, 2], invoice.Cells[row0 + 1, 12]).Value2 = new object[1, 11] {
                { "Invoice Total", "", "", "", "", "", "", "", "", "", "" }
            };
            invoice.get_Range(invoice.Cells[row0 + 1, 2], invoice.Cells[row0 + 1, 2]).Font.Bold = true;
            invoice.get_Range(invoice.Cells[row0 + 2, 2], invoice.Cells[row0 + 2, 12]).Value2   = new object[1, 11] {
                { "", "", "", "", "", "", "", "", "", "", "" }
            };
            invoice.get_Range(invoice.Cells[row0 + 3, 2], invoice.Cells[row0 + 3, 12]).Value2 = new object[1, 11] {
                { "", "", "", "Inland", "Distribution", "Total", "", "", "", "", "" }
            };
            r        = invoice.get_Range(invoice.Cells[row0 + 4, 2], invoice.Cells[row0 + 4, 12]);
            r.Value2 = new object[1, 11] {
                { "Cartons", "Weight(kg)", "Weight(lbs)", "Charges", "Charges", "Charges", "", "", "", "", "" }
            };
            r.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeBottom].Color = Color.Black.ToArgb();

            //Set named range summary values
            _rows           += 1;
            object[,] totals = new object[1, 6];
            totals[0, 0]     = total.Cartons;
            totals[0, 1]     = total.WeightKg;
            totals[0, 2]     = total.Weight;
            totals[0, 3]     = total.InlandCharges;
            totals[0, 4]     = total.DistributionCharges;
            totals[0, 5]     = total.TotalCharges;
            invoice.get_Range(invoice.Cells[row0 + 5, 2], invoice.Cells[row0 + 5, 7]).Value2       = totals;
            invoice.get_Range(invoice.Cells[row0 + 5, 2], invoice.Cells[row0 + 5, 2]).NumberFormat = "#,##0";
            invoice.get_Range(invoice.Cells[row0 + 5, 3], invoice.Cells[row0 + 5, 3]).NumberFormat = "#,##0.00";
            invoice.get_Range(invoice.Cells[row0 + 5, 4], invoice.Cells[row0 + 5, 4]).NumberFormat = "#,##0";
            invoice.get_Range(invoice.Cells[row0 + 5, 5], invoice.Cells[row0 + 5, 5]).NumberFormat = "$#,##0.00_);($#,##0.00)";
            invoice.get_Range(invoice.Cells[row0 + 5, 6], invoice.Cells[row0 + 5, 6]).NumberFormat = "$#,##0.00_);($#,##0.00)";
            invoice.get_Range(invoice.Cells[row0 + 5, 7], invoice.Cells[row0 + 5, 7]).NumberFormat = "$#,##0.00_);($#,##0.00)";
            return(_rows);
        }
Example #2
0
        private void createInvoiceHeader(string invoiceNumber, InvoiceDS.InvoiceTotalTableRow total)
        {
            Invoice invoice = global::Argix.Finance.Globals.Invoice;

            //Remit To
            invoice.RemitToName.Value         = total.RemitToName.Trim();
            invoice.RemitToAddressLine1.Value = total.RemitToAddressLine1.Trim();
            invoice.RemitToAddressLine2.Value = total.IsRemitToAddressLine2Null() ? "" : total.RemitToAddressLine2.Trim();
            invoice.RemitToCityStateZip.Value = total.RemitToCity.Trim() + ", " + total.RemitToState.Trim() + " " + total.RemitToZip.Trim() + "-" + total.RemitToZip4;
            invoice.Telephone.Value           = (total.IsTelephoneNull() ? "" : total.Telephone.ToString());

            //Bill To
            invoice.BillToName.Value         = "Benetton";
            invoice.BillToAddressLine1.Value = invoice.BillToAddressLine2.Value = invoice.BillToCityStateZip.Value = "";

            //Account
            invoice.InvoiceNumber.Value = invoiceNumber;
            invoice.InvoiceDate.Value   = total.InvoiceDate;
        }