Ejemplo n.º 1
0
        private void createDetailBody(InvoiceDS.ClientInvoiceTableDataTable invoiceTable)
        {
            //Get worksheet
            Detail ws = global::Argix.Finance.Globals.Detail;

            Application.ScreenUpdating = false;

            //Insert a row at row0 + 1 (pushes down) for every row of data
            int rowCount = invoiceTable.Rows.Count;

            Excel.Range row0 = ws.get_Range(ws.Cells[ROW0_DETAIL + 1, 1], ws.Cells[ROW0_DETAIL + 1, 16]).EntireRow;
            for (int i = 0; i < rowCount - 1; i++)
            {
                row0.Insert(Excel.XlInsertShiftDirection.xlShiftDown, false);
            }

            //Populate entire data table into a range of worksheet cells
            object[,] values = new object[rowCount, 16];
            for (int i = 0; i < rowCount; i++)
            {
                values[i, 0]  = "'" + invoiceTable[i].StoreName.Trim();
                values[i, 1]  = "'" + invoiceTable[i].StoreState;
                values[i, 2]  = "'" + invoiceTable[i].StoreZip;
                values[i, 3]  = "'" + invoiceTable[i].LocationCode;
                values[i, 4]  = invoiceTable[i].CtnQty;
                values[i, 5]  = invoiceTable[i].CartonRate;
                values[i, 6]  = invoiceTable[i].PltQty;
                values[i, 7]  = invoiceTable[i].PalletRate;
                values[i, 8]  = invoiceTable[i].Weight;
                values[i, 9]  = invoiceTable[i].RatedWeight;
                values[i, 10] = invoiceTable[i].WeightRate;
                values[i, 11] = invoiceTable[i].Surcharge;
                values[i, 12] = invoiceTable[i].ConsolidationCharge;
                values[i, 13] = invoiceTable[i].FuelRate;
                values[i, 14] = invoiceTable[i].FuelSurcharge;
                values[i, 15] = invoiceTable[i].DeliveryTotal;
            }
            ws.get_Range(ws.Cells[ROW0_DETAIL, 1], ws.Cells[ROW0_DETAIL + rowCount - 1, 16]).Value2 = values;

            #region Column Formats
            ws.get_Range(ws.Cells[ROW0_DETAIL, 1], ws.Cells[ROW0_DETAIL + rowCount - 1, 1]).HorizontalAlignment   = Excel.XlHAlign.xlHAlignLeft;
            ws.get_Range(ws.Cells[ROW0_DETAIL, 2], ws.Cells[ROW0_DETAIL + rowCount - 1, 2]).HorizontalAlignment   = Excel.XlHAlign.xlHAlignLeft;
            ws.get_Range(ws.Cells[ROW0_DETAIL, 3], ws.Cells[ROW0_DETAIL + rowCount - 1, 3]).HorizontalAlignment   = Excel.XlHAlign.xlHAlignLeft;
            ws.get_Range(ws.Cells[ROW0_DETAIL, 4], ws.Cells[ROW0_DETAIL + rowCount - 1, 4]).HorizontalAlignment   = Excel.XlHAlign.xlHAlignLeft;
            ws.get_Range(ws.Cells[ROW0_DETAIL, 5], ws.Cells[ROW0_DETAIL + rowCount - 1, 5]).NumberFormat          = "#,###_);(#,###)";
            ws.get_Range(ws.Cells[ROW0_DETAIL, 5], ws.Cells[ROW0_DETAIL + rowCount - 1, 5]).HorizontalAlignment   = Excel.XlHAlign.xlHAlignRight;
            ws.get_Range(ws.Cells[ROW0_DETAIL, 6], ws.Cells[ROW0_DETAIL + rowCount - 1, 6]).NumberFormat          = "#,###.##_);(#,###.##);_(* _)";
            ws.get_Range(ws.Cells[ROW0_DETAIL, 6], ws.Cells[ROW0_DETAIL + rowCount - 1, 6]).HorizontalAlignment   = Excel.XlHAlign.xlHAlignRight;
            ws.get_Range(ws.Cells[ROW0_DETAIL, 7], ws.Cells[ROW0_DETAIL + rowCount - 1, 7]).NumberFormat          = "#,###_);(#,###)";
            ws.get_Range(ws.Cells[ROW0_DETAIL, 7], ws.Cells[ROW0_DETAIL + rowCount - 1, 7]).HorizontalAlignment   = Excel.XlHAlign.xlHAlignRight;
            ws.get_Range(ws.Cells[ROW0_DETAIL, 8], ws.Cells[ROW0_DETAIL + rowCount - 1, 8]).NumberFormat          = "#,###.##_);(#,###.##);_(* _)";
            ws.get_Range(ws.Cells[ROW0_DETAIL, 8], ws.Cells[ROW0_DETAIL + rowCount - 1, 8]).HorizontalAlignment   = Excel.XlHAlign.xlHAlignRight;
            ws.get_Range(ws.Cells[ROW0_DETAIL, 9], ws.Cells[ROW0_DETAIL + rowCount - 1, 9]).NumberFormat          = "#,##0_);(#,##0)";
            ws.get_Range(ws.Cells[ROW0_DETAIL, 9], ws.Cells[ROW0_DETAIL + rowCount - 1, 9]).HorizontalAlignment   = Excel.XlHAlign.xlHAlignRight;
            ws.get_Range(ws.Cells[ROW0_DETAIL, 10], ws.Cells[ROW0_DETAIL + rowCount - 1, 10]).NumberFormat        = "#,##0_);(#,##0)";
            ws.get_Range(ws.Cells[ROW0_DETAIL, 10], ws.Cells[ROW0_DETAIL + rowCount - 1, 10]).HorizontalAlignment = Excel.XlHAlign.xlHAlignRight;
            ws.get_Range(ws.Cells[ROW0_DETAIL, 11], ws.Cells[ROW0_DETAIL + rowCount - 1, 11]).NumberFormat        = "#,##0.00_);(#,##0.00)";
            ws.get_Range(ws.Cells[ROW0_DETAIL, 11], ws.Cells[ROW0_DETAIL + rowCount - 1, 11]).HorizontalAlignment = Excel.XlHAlign.xlHAlignRight;
            ws.get_Range(ws.Cells[ROW0_DETAIL, 12], ws.Cells[ROW0_DETAIL + rowCount - 1, 12]).NumberFormat        = "$#,##0.00_);($#,##0.00);_(* _)";
            ws.get_Range(ws.Cells[ROW0_DETAIL, 12], ws.Cells[ROW0_DETAIL + rowCount - 1, 12]).HorizontalAlignment = Excel.XlHAlign.xlHAlignRight;
            ws.get_Range(ws.Cells[ROW0_DETAIL, 13], ws.Cells[ROW0_DETAIL + rowCount - 1, 13]).NumberFormat        = "$#,##0.00_);($#,##0.00);_(* _)";
            ws.get_Range(ws.Cells[ROW0_DETAIL, 13], ws.Cells[ROW0_DETAIL + rowCount - 1, 13]).HorizontalAlignment = Excel.XlHAlign.xlHAlignRight;
            ws.get_Range(ws.Cells[ROW0_DETAIL, 14], ws.Cells[ROW0_DETAIL + rowCount - 1, 14]).NumberFormat        = "#,##0.0000_);(#,##0.0000)";
            ws.get_Range(ws.Cells[ROW0_DETAIL, 14], ws.Cells[ROW0_DETAIL + rowCount - 1, 14]).HorizontalAlignment = Excel.XlHAlign.xlHAlignRight;
            ws.get_Range(ws.Cells[ROW0_DETAIL, 15], ws.Cells[ROW0_DETAIL + rowCount - 1, 15]).NumberFormat        = "$#,##0.00_);($#,##0.00)";
            ws.get_Range(ws.Cells[ROW0_DETAIL, 15], ws.Cells[ROW0_DETAIL + rowCount - 1, 15]).HorizontalAlignment = Excel.XlHAlign.xlHAlignRight;
            ws.get_Range(ws.Cells[ROW0_DETAIL, 16], ws.Cells[ROW0_DETAIL + rowCount - 1, 16]).NumberFormat        = "$#,##0.00_);($#,##0.00)";
            ws.get_Range(ws.Cells[ROW0_DETAIL, 16], ws.Cells[ROW0_DETAIL + rowCount - 1, 16]).HorizontalAlignment = Excel.XlHAlign.xlHAlignRight;
            #endregion
            Application.ScreenUpdating = true;
        }
Ejemplo n.º 2
0
        private void createDetailTotals(InvoiceDS.ClientInvoiceTableDataTable invoiceTable)
        {
            //Get worksheet
            Detail ws = global::Argix.Finance.Globals.Detail;

            //Totals
            int rowCount = invoiceTable.Rows.Count;

            object[,] totals = new object[1, 16];
            int     qty = 0, weight = 0;
            decimal fs = 0.0M, dt = 0.0M;

            for (int i = 0; i < rowCount; i++)
            {
                qty    += invoiceTable[i].CtnQty;
                weight += invoiceTable[i].Weight;
                fs     += invoiceTable[i].FuelSurcharge;
                dt     += invoiceTable[i].DeliveryTotal;
            }
            totals[0, 0]  = "TOTAL " + rowCount.ToString() + " DELIVERIES";
            totals[0, 1]  = totals[0, 2] = totals[0, 3] = "";
            totals[0, 4]  = qty;
            totals[0, 5]  = totals[0, 6] = totals[0, 7] = "";
            totals[0, 8]  = weight;
            totals[0, 9]  = totals[0, 10] = totals[0, 11] = totals[0, 12] = totals[0, 13] = "";
            totals[0, 14] = fs;
            totals[0, 15] = dt;
            ws.get_Range(ws.Cells[ROW0_DETAIL + rowCount + 1, 1], ws.Cells[ROW0_DETAIL + rowCount + 1, 16]).Value2 = totals;

            ws.get_Range(ws.Cells[ROW0_DETAIL + rowCount + 1, 5], ws.Cells[ROW0_DETAIL + rowCount + 1, 5]).NumberFormat          = "#,###_);(#,###)";
            ws.get_Range(ws.Cells[ROW0_DETAIL + rowCount + 1, 5], ws.Cells[ROW0_DETAIL + rowCount + 1, 5]).HorizontalAlignment   = Excel.XlHAlign.xlHAlignRight;
            ws.get_Range(ws.Cells[ROW0_DETAIL + rowCount + 1, 9], ws.Cells[ROW0_DETAIL + rowCount + 1, 9]).NumberFormat          = "#,##0_);(#,##0)";
            ws.get_Range(ws.Cells[ROW0_DETAIL + rowCount + 1, 9], ws.Cells[ROW0_DETAIL + rowCount + 1, 9]).HorizontalAlignment   = Excel.XlHAlign.xlHAlignRight;
            ws.get_Range(ws.Cells[ROW0_DETAIL + rowCount + 1, 15], ws.Cells[ROW0_DETAIL + rowCount + 1, 15]).NumberFormat        = "$#,##0.00_);($#,##0.00)";
            ws.get_Range(ws.Cells[ROW0_DETAIL + rowCount + 1, 15], ws.Cells[ROW0_DETAIL + rowCount + 1, 15]).HorizontalAlignment = Excel.XlHAlign.xlHAlignRight;
            ws.get_Range(ws.Cells[ROW0_DETAIL + rowCount + 1, 16], ws.Cells[ROW0_DETAIL + rowCount + 1, 16]).NumberFormat        = "$#,##0.00_);($#,##0.00)";
            ws.get_Range(ws.Cells[ROW0_DETAIL + rowCount + 1, 16], ws.Cells[ROW0_DETAIL + rowCount + 1, 16]).HorizontalAlignment = Excel.XlHAlign.xlHAlignRight;


            //Footer
            ws.get_Range(ws.Cells[ROW0_DETAIL + rowCount + 3, 1], ws.Cells[ROW0_DETAIL + rowCount + 3, 16]).Value2 = new object[1, 16] {
                { "PLEASE REFERENCE INVOICE# " + invoiceTable[0].InvoiceNumber + " WHEN REMITTING PAYMENT I.C.C. REGULATIONS REQUIRE THAT THIS BILL BE PAID WITHIN 7 DAYS", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }
            };
            ws.get_Range(ws.Cells[ROW0_DETAIL + rowCount + 4, 1], ws.Cells[ROW0_DETAIL + rowCount + 4, 16]).Value2 = new object[1, 16] {
                { "", "", "A SERVICE CHARGE OF 1.5% PER MONTH IS ADDED TO ALL PAST DUE INVOICES", "", "", "", "", "", "", "", "", "", "", "", "", "" }
            };
            ws.get_Range(ws.Cells[ROW0_DETAIL + rowCount + 5, 1], ws.Cells[ROW0_DETAIL + rowCount + 5, 16]).Value2 = new object[1, 16] {
                { "", "", "REMIT TO: " + invoiceTable[0].RemitToName.Trim() + " " + invoiceTable[0].RemitToAddressLine1.Trim() + " " + invoiceTable[0].RemitToAddressLine2.Trim() + " " + invoiceTable[0].RemitToCity.Trim() + ", " + invoiceTable[0].RemitToState + " " + invoiceTable[0].RemitToZip + "-" + invoiceTable[0].RemitToZip4, "", "", "", "", "", "", "", "", "", "", "", "", "" }
            };
        }
Ejemplo n.º 3
0
        private void showDetail(InvoiceDS ds)
        {
            //Get worksheet
            Detail detail = global::Argix.Finance.Globals.Detail;

            //Header
            int rows = ds.InvoiceDetailTable.Rows.Count;

            if (rows == 0)
            {
                return;
            }
            detail.Manifests.Value = ds.InvoiceDetailTable[0].ManifestNumbers;
            detail.PerGallon.Value = ds.InvoiceDetailTable[0].PerGallon;
            detail.FSC.Value       = ds.InvoiceDetailTable[0].FSCPercentage / 100;

            //Detail
            object[,] destZip        = new object[rows, 1];
            object[,] store          = new object[rows, 1];
            object[,] city           = new object[rows, 1];
            object[,] state          = new object[rows, 1];
            object[,] pieces         = new object[rows, 1];
            object[,] weight         = new object[rows, 1];
            object[,] delivrate      = new object[rows, 1];
            object[,] delivchgs      = new object[rows, 1];
            object[,] fuelsurchg     = new object[rows, 1];
            object[,] totaldelivchgs = new object[rows, 1];
            object[,] lhalloc        = new object[rows, 1];
            object[,] totalchgs      = new object[rows, 1];
            for (int i = 0; i < rows; i++)
            {
                if (!ds.InvoiceDetailTable[i].IsDestinationZipNull())
                {
                    destZip[i, 0] = ds.InvoiceDetailTable[i].DestinationZip;
                }
                if (!ds.InvoiceDetailTable[i].IsStoreNumberNull())
                {
                    store[i, 0] = ds.InvoiceDetailTable[i].StoreNumber;
                }
                if (!ds.InvoiceDetailTable[i].IsStoreCityNull())
                {
                    city[i, 0] = ds.InvoiceDetailTable[i].StoreCity;
                }
                if (!ds.InvoiceDetailTable[i].IsDestinationStateNull())
                {
                    state[i, 0] = ds.InvoiceDetailTable[i].DestinationState;
                }
                if (!ds.InvoiceDetailTable[i].IsTotalPiecesNull())
                {
                    pieces[i, 0] = ds.InvoiceDetailTable[i].TotalPieces;
                }
                if (!ds.InvoiceDetailTable[i].IsTotalWeightNull())
                {
                    weight[i, 0] = ds.InvoiceDetailTable[i].TotalWeight;
                }
                if (!ds.InvoiceDetailTable[i].IsDeliveryRateNull())
                {
                    delivrate[i, 0] = ds.InvoiceDetailTable[i].DeliveryRate;
                }
                if (!ds.InvoiceDetailTable[i].IsDeliveryChargesNull())
                {
                    delivchgs[i, 0] = ds.InvoiceDetailTable[i].DeliveryCharges;
                }
                if (!ds.InvoiceDetailTable[i].IsFuelSurchargeNull())
                {
                    fuelsurchg[i, 0] = ds.InvoiceDetailTable[i].FuelSurcharge;
                }
                if (!ds.InvoiceDetailTable[i].IsTotalDeliveryChargesNull())
                {
                    totaldelivchgs[i, 0] = ds.InvoiceDetailTable[i].TotalDeliveryCharges;
                }
                if (!ds.InvoiceDetailTable[i].IsLHAllocationNull())
                {
                    lhalloc[i, 0] = ds.InvoiceDetailTable[i].LHAllocation;
                }
                if (!ds.InvoiceDetailTable[i].IsTotalChargesNull())
                {
                    totalchgs[i, 0] = ds.InvoiceDetailTable[i].TotalCharges;
                }
            }
            detail.get_Range(detail.Cells[4, 1], detail.Cells[3 + rows, 1]).Value2   = destZip;
            detail.get_Range(detail.Cells[4, 2], detail.Cells[3 + rows, 2]).Value2   = store;
            detail.get_Range(detail.Cells[4, 3], detail.Cells[3 + rows, 3]).Value2   = city;
            detail.get_Range(detail.Cells[4, 4], detail.Cells[3 + rows, 4]).Value2   = state;
            detail.get_Range(detail.Cells[4, 5], detail.Cells[3 + rows, 5]).Value2   = pieces;
            detail.get_Range(detail.Cells[4, 6], detail.Cells[3 + rows, 6]).Value2   = weight;
            detail.get_Range(detail.Cells[4, 7], detail.Cells[3 + rows, 7]).Value2   = delivrate;
            detail.get_Range(detail.Cells[4, 8], detail.Cells[3 + rows, 8]).Value2   = delivchgs;
            detail.get_Range(detail.Cells[4, 9], detail.Cells[3 + rows, 9]).Value2   = fuelsurchg;
            detail.get_Range(detail.Cells[4, 10], detail.Cells[3 + rows, 10]).Value2 = totaldelivchgs;
            detail.get_Range(detail.Cells[4, 11], detail.Cells[3 + rows, 11]).Value2 = lhalloc;
            detail.get_Range(detail.Cells[4, 12], detail.Cells[3 + rows, 12]).Value2 = totalchgs;
        }