コード例 #1
0
ファイル: PackingListDB.cs プロジェクト: mercaditu/ERP
        public sales_packing New()
        {
            sales_packing sales_packing = new sales_packing();

            sales_packing.State      = EntityState.Added;
            sales_packing.id_range   = Brillo.GetDefault.Return_RangeID(App.Names.PackingList);
            sales_packing.IsSelected = true;

            return(sales_packing);
        }
コード例 #2
0
ファイル: PackingListDB.cs プロジェクト: mercaditu/ERP
        private void add_CRM(sales_packing sales_packing)
        {
            if (sales_packing.id_sales_packing == 0 || sales_packing == null)
            {
                crm_opportunity crm_opportunity = new crm_opportunity();
                crm_opportunity.id_contact = sales_packing.id_contact;

                crm_opportunity.sales_packing.Add(sales_packing);
                base.crm_opportunity.Add(crm_opportunity);
            }
            else
            {
                crm_opportunity crm_opportunity = sales_order.Where(x => x.id_sales_order == sales_packing.id_sales_packing).FirstOrDefault().crm_opportunity;
                crm_opportunity.sales_packing.Add(sales_packing);
                base.crm_opportunity.Attach(crm_opportunity);
            }
        }
コード例 #3
0
ファイル: DocumentViewr.xaml.cs プロジェクト: mercaditu/ERP
        public void loadSalesPackingList(int id)
        {
            try
            {
                ReportDataSource reportDataSource = new ReportDataSource();
                reportDataSource.Name = "DataSet1"; // Name of the DataSet we set in .rdlc
                sales_packing sales_packing = db.sales_packing.Where(x => x.id_sales_packing == id).FirstOrDefault();
                List <sales_packing_detail> sales_packing_detail = db.sales_packing_detail.Where(x => x.id_sales_packing == sales_packing.id_sales_packing).ToList();

                reportDataSource.Value = sales_packing_detail
                                         .Select(g => new
                {
                    contact_name        = g.sales_packing.contact.name,
                    customer_address    = g.sales_packing.contact.address,
                    customer_telephone  = g.sales_packing.contact.telephone,
                    customer_email      = g.sales_packing.contact.email,
                    company_Name        = g.app_company.name,
                    sales_terminal      = g.sales_packing.app_terminal.name,
                    branch_Name         = g.sales_packing.app_branch.name,
                    security_user_name  = g.sales_packing.security_user.name,
                    trans_date          = g.sales_packing.trans_date,
                    sales_order_Comment = g.sales_packing.comment,
                    item_code           = g.item.code,
                    item_description    = g.item.name,
                    item_brand          = g.item.item_brand != null ? g.item.item_brand.name : "",
                    quantity            = g.quantity,
                }).ToList();

                string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                path = path + "\\CogntivoERP";
                string SubFolder = "";
                SubFolder = "\\TemplateFiles";
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                    Directory.CreateDirectory(path + SubFolder);
                    File.Copy(AppDomain.CurrentDomain.BaseDirectory + "\\bin\\debug\\Sales_PackingList.rdlc", path + SubFolder + "\\Sales_PackingList.rdlc");
                }
                else if (!Directory.Exists(path + SubFolder))
                {
                    Directory.CreateDirectory(path + SubFolder);
                    File.Copy(AppDomain.CurrentDomain.BaseDirectory + "\\bin\\debug\\Sales_PackingList.rdlc", path + SubFolder + "\\Sales_PackingList.rdlc");
                }
                else if (!File.Exists(path + SubFolder + "\\Sales_PackingList.rdlc"))
                {
                    File.Copy(AppDomain.CurrentDomain.BaseDirectory + "\\bin\\debug\\Sales_PackingList.rdlc", path + SubFolder + "\\Sales_PackingList.rdlc");
                }

                if (!sales_packing.app_document_range.use_default_printer)
                {
                    reportViewer.LocalReport.ReportPath = path + SubFolder + "\\Sales_PackingList.rdlc"; // Path of the rdlc file
                    reportViewer.LocalReport.DataSources.Add(reportDataSource);
                    reportViewer.RefreshReport();
                }
                else
                {
                    try
                    {
                        if (sales_packing.app_document_range.printer_name != null)
                        {
                            LocalReport  report       = new LocalReport();
                            PrintInvoice PrintInvoice = new PrintInvoice();
                            report.ReportPath = path + SubFolder + "\\Sales_PackingList.rdlc"; // Path of the rdlc file
                            report.DataSources.Add(reportDataSource);
                            PrintInvoice.Export(report);
                            PrintInvoice.Print(sales_packing.app_document_range.printer_name);
                        }
                        else
                        {
                            NotSupportedException ex = new NotSupportedException();
                            throw ex;
                        }
                    }
                    catch
                    {
                        reportViewer.LocalReport.ReportPath = path + SubFolder + "\\Sales_PackingList.rdlc"; // Path of the rdlc file
                        reportViewer.LocalReport.DataSources.Add(reportDataSource);
                        reportViewer.RefreshReport();
                        Window window = new Window
                        {
                            Title   = "Report",
                            Content = this
                        };

                        window.ShowDialog();
                    }
                }
            }
            catch { }
        }