private int createInvoiceBodyShipments(InvoiceDS.InvoiceShipmentTableRow shipment, int row0) { //Get worksheet int _rows = 0; Invoice invoice = global::Argix.Finance.Globals.Invoice; //Column headers _rows += 5; 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] { { "Inland Charges", "", "", "", "", "", "", "", "", "", "" } }; 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] { { "", "", "Trucking", "Fuel", "Devanning", "", "Airline", "", "", "", "" } }; invoice.get_Range(invoice.Cells[row0 + 4, 2], invoice.Cells[row0 + 4, 12]).Value2 = new object[1, 11] { { "", "Custom DOC", "Rate", "Surcharge", "Unite", "Insurance", "Import Fee", "House B/L", "Miscellaneous", "Total Inland", "" } }; invoice.get_Range(invoice.Cells[row0 + 5, 2], invoice.Cells[row0 + 5, 12]).Value2 = new object[1, 11] { { "Shipment#", "Charges", "Charges", "Charges", "Charges", "Charges", "Charges", "Charges", "Charges", "Charges", "" } }; r = invoice.get_Range(invoice.Cells[row0 + 5, 2], invoice.Cells[row0 + 5, 11]); r.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeBottom].Color = Color.Black.ToArgb(); //Set named range summary values _rows += 1; object[,] _shipment = new object[1, 10]; _shipment[0, 0] = shipment.ShipmentNumber; _shipment[0, 1] = shipment.CustomDocCharges; _shipment[0, 2] = shipment.TruckingRatesCharges; _shipment[0, 3] = shipment.FSCCharges; _shipment[0, 4] = shipment.DevanningUniteChargtes; _shipment[0, 5] = shipment.InsuranceCharges; _shipment[0, 6] = shipment.AirLineImportFeeCharges; _shipment[0, 7] = shipment.HouseBLCharges; _shipment[0, 8] = shipment.MiscellaneousCharges; _shipment[0, 9] = shipment.TotalInlandCharges; invoice.get_Range(invoice.Cells[row0 + 6, 2], invoice.Cells[row0 + 6, 11]).Value2 = _shipment; invoice.get_Range(invoice.Cells[row0 + 6, 2], invoice.Cells[row0 + 6, 2]).NumberFormat = "@"; invoice.get_Range(invoice.Cells[row0 + 6, 3], invoice.Cells[row0 + 6, 3]).NumberFormat = "$#,##0.00_);($#,##0.00)"; invoice.get_Range(invoice.Cells[row0 + 6, 4], invoice.Cells[row0 + 6, 4]).NumberFormat = "$#,##0.00_);($#,##0.00)"; invoice.get_Range(invoice.Cells[row0 + 6, 5], invoice.Cells[row0 + 6, 5]).NumberFormat = "$#,##0.00_);($#,##0.00)"; invoice.get_Range(invoice.Cells[row0 + 6, 6], invoice.Cells[row0 + 6, 6]).NumberFormat = "$#,##0.00_);($#,##0.00)"; invoice.get_Range(invoice.Cells[row0 + 6, 7], invoice.Cells[row0 + 6, 7]).NumberFormat = "$#,##0.00_);($#,##0.00)"; invoice.get_Range(invoice.Cells[row0 + 6, 8], invoice.Cells[row0 + 6, 8]).NumberFormat = "$#,##0.00_);($#,##0.00)"; invoice.get_Range(invoice.Cells[row0 + 6, 9], invoice.Cells[row0 + 6, 9]).NumberFormat = "$#,##0.00_);($#,##0.00)"; invoice.get_Range(invoice.Cells[row0 + 6, 10], invoice.Cells[row0 + 6, 10]).NumberFormat = "$#,##0.00_);($#,##0.00)"; invoice.get_Range(invoice.Cells[row0 + 6, 11], invoice.Cells[row0 + 6, 11]).NumberFormat = "$#,##0.00_);($#,##0.00)"; return(_rows); }
private int showHeader(InvoiceDS.InvoiceShipmentTableRow shipment) { //Get worksheet Invoice invoice = global::Argix.Finance.Globals.Invoice; float w = (float)(5 * invoice.StandardWidth), h = (float)invoice.StandardHeight; invoice.Shapes.AddLine(0, h / 2, 16 * w, h / 2); invoice.Range[invoice.Cells[2, 1], invoice.Cells[2, 11]].Value2 = new object[1, 11] { { shipment.RemitToName.Trim(), "", "", shipment.RemitToAddressLine1.Trim() + " " + shipment.RemitToAddressLine2.Trim() + " " + shipment.RemitToCity.Trim() + ", " + shipment.RemitToState + " " + shipment.RemitToZip + "-" + shipment.RemitToZip4, "", "", "", "", "", shipment.Telephone, "" } }; invoice.Range[invoice.Cells[2, 10], invoice.Cells[2, 11]].Merge(null); invoice.Range[invoice.Cells[2, 10], invoice.Cells[2, 10]].NumberFormat = "(###)_ ###-####"; invoice.Shapes.AddLine(0, 5 * h / 2, 16 * w, 5 * h / 2); invoice.Range[invoice.Cells[4, 1], invoice.Cells[4, 11]].Value2 = new object[1, 11] { { "", "", "", "", "", "---- INVOICE ----", "", "", "", "Invoice#: ", shipment.InvoiceNumber } }; invoice.Range[invoice.Cells[4, 10], invoice.Cells[4, 10]].HorizontalAlignment = Excel.XlHAlign.xlHAlignRight; invoice.Range[invoice.Cells[4, 11], invoice.Cells[4, 11]].HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft; invoice.Range[invoice.Cells[5, 1], invoice.Cells[5, 11]].Value2 = new object[1, 11] { { shipment.ClientNumber + " " + shipment.ClientDivision + " - ", shipment.BillToName.Trim(), "", "", "", "", "", "", "", "", "" } }; invoice.Range[invoice.Cells[5, 1], invoice.Cells[5, 1]].HorizontalAlignment = Excel.XlHAlign.xlHAlignRight; invoice.Range[invoice.Cells[5, 10], invoice.Cells[5, 10]].HorizontalAlignment = Excel.XlHAlign.xlHAlignRight; invoice.Range[invoice.Cells[5, 11], invoice.Cells[5, 11]].HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft; invoice.Range[invoice.Cells[6, 1], invoice.Cells[6, 11]].Value2 = new object[1, 11] { { "", shipment.BillToAddressline1.Trim(), "", "", "", "", "", "", "", "Invoice Date: ", shipment.InvoiceDate.ToString("MM/dd/yyyy") } }; invoice.Range[invoice.Cells[6, 10], invoice.Cells[6, 10]].HorizontalAlignment = Excel.XlHAlign.xlHAlignRight; invoice.Range[invoice.Cells[6, 11], invoice.Cells[6, 11]].HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft; invoice.Range[invoice.Cells[7, 1], invoice.Cells[7, 11]].Value2 = new object[1, 11] { { "", shipment.BillToAddressline2.Trim(), "", "", "", "", "", "", "", "Release Date: ", shipment.ReleaseDate.ToString("MM/dd/yyyy") } }; invoice.Range[invoice.Cells[7, 10], invoice.Cells[7, 10]].HorizontalAlignment = Excel.XlHAlign.xlHAlignRight; invoice.Range[invoice.Cells[7, 11], invoice.Cells[7, 11]].HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft; invoice.Range[invoice.Cells[8, 1], invoice.Cells[8, 11]].Value2 = new object[1, 11] { { "", shipment.BillToCity.Trim() + ", " + shipment.BillToState + " " + shipment.BillToZip + "-" + shipment.BillToZIP4, "", "", "", "", "", "", "", "", "" } }; return(8); }