private void cbxDocument_SelectionChanged(object sender, SelectionChangedEventArgs e) { app_document app_document = (app_document)cbxDocument.SelectedItem; if (app_document != null) { if (app_document.filterby_branch) { stackBranch.Visibility = Visibility.Visible; } else { stackBranch.Visibility = Visibility.Collapsed; } if (app_document.filterby_tearminal) { stackTerminal.Visibility = Visibility.Visible; } else { stackTerminal.Visibility = Visibility.Collapsed; } } }
private void toolBar_btnNew_Click(object sender) { app_document app_document = new app_document(); app_document.State = EntityState.Added; app_document.IsSelected = true; dbcontext.Entry(app_document).State = EntityState.Added; app_documentViewSource.View.MoveCurrentToLast(); }
public void Document_PrintItemRequest(int document_id, item_transfer item_transfer) { app_document app_document = null; string PrinterName = string.Empty; using (db db = new db()) { if (db.app_document.Where(x => x.id_document == document_id).FirstOrDefault() != null) { app_document = db.app_document.Where(x => x.id_document == document_id).FirstOrDefault(); PrinterName = app_document.app_document_range.FirstOrDefault().printer_name; } } if (app_document != null && PrinterName != string.Empty) { if (app_document.style_reciept == true) { Reciept Reciept = new Reciept(); PrintDialog pd = new PrintDialog(); FlowDocument document = new FlowDocument(new Paragraph(new Run(Reciept.ItemMovement(item_transfer)))); document.Name = "ItemMovement"; document.FontFamily = new FontFamily("Courier New"); document.FontSize = 11.0; document.FontStretch = FontStretches.Normal; document.FontWeight = FontWeights.Normal; document.PagePadding = new Thickness(20); document.PageHeight = double.NaN; document.PageWidth = double.NaN; //document. //Specify minimum page sizes. Origintally 283, but was too small. document.MinPageWidth = 283; //Specify maximum page sizes. document.MaxPageWidth = 300; IDocumentPaginatorSource idpSource = document; try { pd.PrintQueue = new PrintQueue(new PrintServer(), PrinterName); pd.PrintDocument(idpSource.DocumentPaginator, document.Name); } catch { if (pd.ShowDialog() == true) { pd.PrintDocument(idpSource.DocumentPaginator, document.Name); } } } } }
private void toolBar_btnEdit_Click(object sender) { if (app_documentDataGrid.SelectedItem != null) { app_document Document = (app_document)app_documentDataGrid.SelectedItem; Document.IsSelected = true; Document.State = System.Data.Entity.EntityState.Modified; } else { toolBar.msgWarning("Please Select a Contact"); } }
private void toolBar_btnSearch_Click(object sender, string query) { if (!string.IsNullOrEmpty(query) && app_documentViewSource != null) { try { app_documentViewSource.View.Filter = i => { app_document app_document = i as app_document; if (app_document != null) { string name = ""; if (app_document.name != null) { name = app_document.name.ToLower(); } if (name.Contains(query.ToLower())) { return(true); } else { return(false); } } else { return(false); } }; } catch (Exception ex) { toolBar.msgError(ex); } } else { app_documentViewSource.View.Filter = null; } }
private void Print(string Content, app_document app_document, string PrinterName) { if (Content != "") { if (app_document != null && PrinterName != string.Empty) { if (app_document.style_reciept == true) { Reciept Reciept = new Reciept(); PrintDialog pd = new PrintDialog(); FlowDocument document = new FlowDocument(new Paragraph(new Run(Content))); document.Name = "CognitivoERP_Ticket"; document.FontFamily = new FontFamily("Courier New"); document.FontSize = 11.0; document.FontStretch = FontStretches.Normal; document.FontWeight = FontWeights.Normal; document.PagePadding = new Thickness(20); document.PageHeight = double.NaN; document.PageWidth = double.NaN; //document. //Specify minimum page sizes. Origintally 283, but was too small. document.MinPageWidth = 283; //Specify maximum page sizes. document.MaxPageWidth = 300; IDocumentPaginatorSource idpSource = document; try { pd.PrintQueue = new PrintQueue(new PrintServer(), PrinterName); pd.PrintDocument(idpSource.DocumentPaginator, Content); } catch { MessageBox.Show("Output (Reciept Printer) not Found Error", "Error 101"); } } } } }
/// <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(); } }