Esempio n. 1
0
        public static string GetInvoice(RestCommand command, int invoiceID)
        {
            Invoice invoice = Invoices.GetInvoice(command.LoginUser, invoiceID);

            if (invoice.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(invoice.GetXml("Invoice", true));
        }
 public ShowInvoiceWindow(string number)
 {
     InitializeComponent();
     currInvoice = Invoices.GetInvoice(number);
     StackPanelClient.DataContext  = currInvoice.Client;
     StackPanelInvoice.DataContext = currInvoice;
     ListViewProducts.ItemsSource  = currInvoice.ProductsList;
     StackPanelSums.DataContext    = currInvoice;
     StackPanelToPay.DataContext   = currInvoice;
     SetLabels();
 }
Esempio n. 3
0
        public ActionResult InvoicesDetailsMode6(int id) //id = InvoiceID
        {
            Invoices_Details viewInvoices_Details = new Invoices_Details();

            viewInvoices_Details.toPrint      = true;
            viewInvoices_Details.showToClient = false;
            viewInvoices_Details.invoice      = Invoices.GetInvoice(id);

            viewInvoices_Details.invoiceLines    = Invoices.GetInvoiceLines(id);
            viewInvoices_Details.numberOfColumns = viewInvoices_Details.invoice.NumberOfColumns;

            viewInvoices_Details.InvoiceType = viewInvoices_Details.invoice.InvoiceTypeDesc;

            return(View("InvoicesDetails", "Print", viewInvoices_Details));
        }
        public FileContentResult PrintReportToPDF(int InvoiceID, int GroupID)
        {
            PdfConverter pdf = new PdfConverter();

            //pdf.PdfDocumentOptions.PdfPageSize = PdfPageSize.Letter;
            pdf.PdfDocumentOptions.BottomMargin       = 0;
            pdf.PdfDocumentOptions.TopMargin          = 15;
            pdf.PdfDocumentOptions.LeftMargin         = 40;
            pdf.PdfDocumentOptions.RightMargin        = 40;
            pdf.PdfDocumentOptions.PdfPageOrientation = PDFPageOrientation.Landscape;
            pdf.PdfDocumentOptions.ShowFooter         = true;
            pdf.PdfFooterOptions.ShowPageNumber       = true;
            pdf.LicenseKey = "q4CZi5qai5Oci5KFm4uYmoWamYWSkpKS";

            string AuthName  = this.Request.Cookies[".ASPXAUTH"].Name;
            string AuthValue = this.Request.Cookies[".ASPXAUTH"].Value;

            //pdf.HttpRequestHeaders = "Cookie: name=" + AuthValue;
            pdf.HttpRequestHeaders = String.Format(
                "Cookie : {0}={1}\r\n", AuthName, AuthValue
                );

            string UrlToPDF = System.Configuration.ConfigurationManager.AppSettings["ExportPDFPath"] //"http://screeningone.com:8080/" /*"http://localhost:1225"*/ /*"http://s1-tpa-dv1:82/"*/
                              + Url.Action("InvoiceReportsIndexMode7", "PDF", new { InvoiceID = InvoiceID, GroupID = GroupID });

            /*PdfConverter pdf2 = new PdfConverter();
             * pdf2.PdfDocumentOptions.BottomMargin = 20;
             * pdf2.PdfDocumentOptions.TopMargin = 20;
             * pdf2.PdfDocumentOptions.PdfPageOrientation = PDFPageOrientation.Landscape;
             * pdf2.PdfDocumentOptions.PrependPDFStream = new System.IO.MemoryStream();
             * pdf2.HttpRequestHeaders = String.Format(
             *  "Cookie : {0}={1}\r\n", AuthName, AuthValue
             * );
             *
             * pdf.SavePdfFromUrlToStream(UrlToPDF, pdf2.PdfDocumentOptions.PrependPDFStream);*/

            Invoice invoiceToExport = Invoices.GetInvoice(InvoiceID);

            FileContentResult fcr = new FileContentResult(pdf.GetPdfFromUrlBytes(UrlToPDF), "application/PDF");

            fcr.FileDownloadName = (invoiceToExport.ClientName + "_" + invoiceToExport.InvoiceNumber).cleanFileName() + "_BillingDetail.pdf";
            return(fcr);
        }