Example #1
0
 //Sales Budget
 public void Document_PrintSalesBudget(int?document_id, sales_budget sales_budget)
 {
     if (sales_budget.app_document_range != null)
     {
         if (sales_budget.app_document_range.printer_name != null)
         {
             DocumentViewr MainWindow = new DocumentViewr();
             MainWindow.loadSalesBudgetReport(sales_budget.id_sales_budget);
         }
         else
         {
             DocumentViewr MainWindow = new DocumentViewr();
             MainWindow.loadSalesBudgetReport(sales_budget.id_sales_budget);
             Window window = new Window
             {
                 Title   = "Document",
                 Content = MainWindow
             };
             window.ShowDialog();
         }
     }
     else
     {
         DocumentViewr MainWindow = new DocumentViewr();
         MainWindow.loadSalesBudgetReport(sales_budget.id_sales_budget);
         Window window = new Window
         {
             Title   = "Document",
             Content = MainWindow
         };
         window.ShowDialog();
     }
 }
Example #2
0
        //Purchase Order
        public void Document_PrintPurchaseOrder(int document_id, purchase_order purchase_order)
        {
            app_document app_document;

            using (db db = new db())
            {
                app_document = db.app_document.Where(x => x.id_document == document_id).FirstOrDefault();
            }
            if (app_document != null)
            {
                if (purchase_order.app_document_range.printer_name != null)
                {
                    DocumentViewr MainWindow = new DocumentViewr();
                    MainWindow.loadPurchaseOrderReport(purchase_order.id_purchase_order);
                }
                else
                {
                    DocumentViewr MainWindow = new DocumentViewr();
                    MainWindow.loadPurchaseOrderReport(purchase_order.id_purchase_order);
                    Window window = new Window
                    {
                        Title   = "Report",
                        Content = MainWindow
                    };

                    window.ShowDialog();
                }
            }
        }
Example #3
0
        //Sales order
        public void Document_PrintOrder(int document_id, sales_order sales_order, bool OverRide_AutoPrint)
        {
            try
            {
                if (sales_order.app_document_range.printer_name != null && OverRide_AutoPrint == false)
                {
                    DocumentViewr MainWindow = new DocumentViewr();
                    MainWindow.loadSalesOrderReport(sales_order.id_sales_order);
                }
                else // true
                {
                    NotSupportedException ex = new NotSupportedException();
                    throw ex;
                }
            }
            catch
            {
                DocumentViewr MainWindow = new DocumentViewr();
                MainWindow.loadSalesOrderReport(sales_order.id_sales_order);

                Window window = new Window
                {
                    Title   = "Report",
                    Content = MainWindow
                };
                window.ShowDialog();
            }
        }
Example #4
0
        public Normal(object Document, app_document_range app_range, PrintStyles PrintStyle)
        {
            if (app_range.app_document != null ? app_range.app_document.style_reciept : false || app_range.app_document != null ? app_range.app_document.id_application == App.Names.PointOfSale:false)
            {
                TicketPrint.Document_Print(app_range.app_document.id_document, Document);
            }
            else
            {
                string DocumentName = string.Empty;
                if (app_range != null)
                {
                    DocumentName = app_range.app_document.name;
                }
                else
                {
                    DocumentName = "PurchaseInvoice";
                }

                string PathFull = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\CogntivoERP\\TemplateFiles\\" + app_range.app_document.name + ".rdlc";


                if (Directory.Exists(PathFull) == false)
                {
                    CreateFile(app_range);
                }

                DataSource DataSource = new DataSource();

                ///
                if (PrintStyle == PrintStyles.Automatic && !app_range.use_default_printer && app_range.printer_name != null)
                {
                    LocalReport  LocalReport  = new LocalReport();
                    PrintInvoice PrintInvoice = new PrintInvoice();
                    LocalReport.ReportPath = PathFull; // Path of the rdlc file
                    LocalReport.DataSources.Add(DataSource.Create(Document));
                    PrintInvoice.Export(LocalReport);
                    PrintInvoice.Print(app_range.printer_name);
                }
                else
                {
                    DocumentViewr DocumentViewr = new DocumentViewr();
                    DocumentViewr.reportViewer.LocalReport.ReportPath = PathFull; // Path of the rdlc file
                    DocumentViewr.reportViewer.LocalReport.DataSources.Add(DataSource.Create(Document));
                    DocumentViewr.reportViewer.RefreshReport();

                    Window window = new Window
                    {
                        Title   = "Report",
                        Content = DocumentViewr
                    };

                    window.ShowDialog();
                }
            }
        }
Example #5
0
        public void Document_PrintCarnetContact()
        {
            DocumentViewr MainWindow = new DocumentViewr();

            MainWindow.loadCarnetcontactReportall();
            Window window = new Window
            {
                Title   = "Report",
                Content = MainWindow
            };

            window.ShowDialog();
        }
Example #6
0
        public void Document_PrintPaymentReceipt(payment payment)
        {
            DocumentViewr MainWindow = new DocumentViewr();

            MainWindow.loadPaymentRecieptReport(payment.id_payment);

            Window window = new Window
            {
                Title   = "Report",
                Content = MainWindow
            };

            window.ShowDialog();
        }
Example #7
0
        /// <summary>
        /// Print Sales Document
        /// </summary>
        /// <param name="app_document"></param>
        /// <param name="sales_invoice"></param>
        public void Document_PrintInvoice(app_document app_document, sales_invoice sales_invoice)
        {
            if (app_document != null)
            {
                if (sales_invoice.app_document_range.printer_name != null)
                {
                    DocumentViewr MainWindow = new DocumentViewr();
                    MainWindow.loadSalesInvoiceReport(sales_invoice.id_sales_invoice);
                }
                else
                {
                    DocumentViewr MainWindow = new DocumentViewr();
                    MainWindow.loadSalesInvoiceReport(sales_invoice.id_sales_invoice);

                    Window window = new Window
                    {
                        Title   = "Report",
                        Content = MainWindow
                    };
                    window.ShowDialog();
                }
            }
            else
            {
                DocumentViewr MainWindow = new DocumentViewr();
                MainWindow.loadSalesInvoiceReport(sales_invoice.id_sales_invoice);

                Window window = new Window
                {
                    Title   = "Report",
                    Content = MainWindow
                };

                window.ShowDialog();
            }
        }
Example #8
0
        //packinglist
        public void Document_PrintPackingList(int document_id, sales_packing sales_packing)
        {
            app_document app_document;

            using (db db = new db())
            {
                app_document = db.app_document.Where(x => x.id_document == document_id).FirstOrDefault();
            }

            if (app_document != null)
            {
                if (app_document.style_reciept == true)
                {
                    string header     = app_document.reciept_header;
                    string Mainheader = "";
                    foreach (sales_packing_detail sales_packing_detail in sales_packing.sales_packing_detail)
                    {
                        Mainheader += header.Replace("<<item>>", sales_packing_detail.item.name);
                        Mainheader += header.Replace("<<debit>>", sales_packing_detail.quantity.ToString());
                        Mainheader += header.Replace("<<Credit>>", "0");
                        Mainheader += header.Replace("<<Transcation>>", sales_packing.trans_date.ToString());
                        Mainheader += "\n";
                    }

                    string footer     = app_document.reciept_footer;
                    string Mainfooter = "";
                    foreach (sales_packing_detail sales_packing_detail in sales_packing.sales_packing_detail)
                    {
                        Mainfooter += footer.Replace("<<item>>", sales_packing_detail.item.name);
                        Mainfooter += footer.Replace("<<debit>>", sales_packing_detail.quantity.ToString());
                        Mainfooter += footer.Replace("<<Credit>>", "0");
                        Mainfooter += footer.Replace("<<Transcation>>", sales_packing.trans_date.ToString());
                        Mainfooter += "\n";
                    }

                    string body     = app_document.reciept_body;
                    string Mainbody = "";
                    foreach (sales_packing_detail sales_packing_detail in sales_packing.sales_packing_detail)
                    {
                        Mainbody += body.Replace("<<item>>", sales_packing_detail.item.name);
                        Mainbody += body.Replace("<<debit>>", sales_packing_detail.quantity.ToString());
                        Mainbody += body.Replace("<<Credit>>", "0");
                        Mainbody += body.Replace("<<Transcation>>", sales_packing.trans_date.ToString());
                        Mainbody += "\n";
                    }


                    PrintDialog  pd  = new PrintDialog();
                    FlowDocument doc = new FlowDocument(new Paragraph(new Run(Mainheader + "\n\n" + Mainbody + "\n\n" + Mainfooter)));
                    doc.Name = "FlowDoc";
                    IDocumentPaginatorSource idpSource = doc;
                    pd.PrintDocument(idpSource.DocumentPaginator, Mainheader + "\n\n" + Mainbody + "\n\n" + Mainfooter);
                }
                else if (app_document.style_printer == true)
                {
                    if (sales_packing.app_document_range.printer_name != null)
                    {
                        DocumentViewr MainWindow = new DocumentViewr();
                        MainWindow.loadSalesPackingList(sales_packing.id_sales_packing);
                    }
                    else
                    {
                        DocumentViewr MainWindow = new DocumentViewr();
                        MainWindow.loadSalesPackingList(sales_packing.id_sales_packing);

                        Window window = new Window
                        {
                            Title   = "Report",
                            Content = MainWindow
                        };

                        window.ShowDialog();
                    }
                }
            }
        }