void SetClientDefDetails()
        {
            if (currentClientDef == null)
            {
                SelectedExtSys            = null;
                SelectedOverRideKeySource = null;
                SelectedExtWorkTypeSource = null;
                return;
            }

            SelectedExtSys            = (ExtSyss.First(es => es.EXT_SYS == currentClientDef.ExtSys) as ExtSys);
            SelectedOverRideKeySource = (OverRideKeySources.First(scm => scm.OVERRIDE_KEY_SOURCE == currentClientDef.OverrideKeySource) as OverRideKeySource);
            SelectedExtWorkTypeSource = (ExtWorkTypeSources.First(ewts => ewts.DESCR == currentClientDef.ExtWorkTypeSourceDescr) as ExtWorkTypeSource);

            if (CurrentClientDef.DefaultInvoiceGrpID > 0)
            {
                InvoiceGroup group = new InvoiceGroup {
                    InvoiceGrpId = (int)CurrentClientDef.DefaultInvoiceGrpID
                };
                group = InvoiceGroupTarget.Get(group);
                CurrentClientDef.DefaultInvoiceGrpName = group.Description;
            }

            currentClientDef.Modified = false;
        }
Exemple #2
0
 void SetIGOs()
 {
     if (selectedInvoiceGroup != null)
     {
         try
         {
             if (invoiceGrpOverrides != null)
             {
                 invoiceGrpOverrides.CollectionChanged -= IGOSListChanged;
             }
             invoiceGrpOverrides = InvoiceGrpOverrideTarget.FetchOverRides(selectedInvoiceGroup.InvoiceGrpId);
             if (invoiceGrpOverrides != null)
             {
                 invoiceGrpOverrides.ForEach((lst, item) =>
                 {
                     InvoiceGroup sendto = new InvoiceGroup {
                         InvoiceGrpId = (int)item.SEND_TO_INVOICE_GRP_ID
                     };
                     sendto           = InvoiceGroupTarget.Get(sendto);
                     item.Description = sendto.Description;
                     item.Modified    = false;
                 });
                 invoiceGrpOverrides.CollectionChanged += IGOSListChanged;
                 bWasDeleted = bWasAdded = false;
                 RaisePropertyChanged("InvoiceGrpOverrides");
             }
         }
         catch (Exception x)
         {
             ThisView.ShowMsg(x.ToString());
         }
     }
 }
        private void ViewDocument()
        {
            if (SelectedInvoices.Count != 1)
            {
                return;
            }
            Invoice      invoice      = SelectedInvoices[0];
            InvoiceGroup invoiceGroup = new InvoiceGroup {
                InvoiceGrpId = (int)invoice.INVOICE_GRP_ID
            };

            invoiceGroup = InvoiceGroupTarget.Get(invoiceGroup);

            string fileName = CreateFileName(invoiceGroup.DefaultBillFilePath,
                                             invoice.BILL_PERIOD_END_BEFORE ?? DateTime.Now,
                                             invoiceGroup.InvoiceGrpId.ToString(),
                                             invoiceGroup.Description,
                                             invoiceGroup.InvoiceGrpId.ToString() + "-" + invoice.INVOICE_ID.ToString(),
                                             false);

            if (ReportType == ReportTypes.BillOnly || ReportType == ReportTypes.BillAndDetail)
            {
                fileName += ".pdf";
            }
            else if (ReportType == ReportTypes.DetailOnly)
            {
                fileName += ".xls";
            }
            else
            {
                return;
            }
            try
            {
                System.Diagnostics.Process.Start(fileName);
            }
            catch (Exception x)
            {
                ThisView.ShowMsg(x.ToString());
            }
        }
        private void PrintDocuments()
        {
            System.Diagnostics.Process PrintProcess = new Process();
            PrintProcess.StartInfo.Verb = "Print";

            foreach (Invoice invoice in SelectedInvoices)
            {
                InvoiceGroup invoiceGroup = new InvoiceGroup {
                    InvoiceGrpId = (int)invoice.INVOICE_GRP_ID
                };
                invoiceGroup = InvoiceGroupTarget.Get(invoiceGroup);

                PrintProcess.StartInfo.FileName = CreateFileName(invoiceGroup.DefaultBillFilePath,
                                                                 invoice.BILL_PERIOD_END_BEFORE ?? DateTime.Now,
                                                                 invoiceGroup.InvoiceGrpId.ToString(),
                                                                 invoiceGroup.Description,
                                                                 invoiceGroup.InvoiceGrpId.ToString() + "-" + invoice.INVOICE_ID.ToString(),
                                                                 false);

                try
                {
                    if (ReportType == ReportTypes.BillOnly || ReportType == ReportTypes.BillAndDetail)
                    {
                        PrintProcess.StartInfo.FileName += ".pdf";
                    }
                    else
                    {
                        PrintProcess.StartInfo.FileName += ".xls";
                    }
                    PrintProcess.Start();
                }
                catch (Exception x)
                {
                    ThisView.ShowMsg(x.ToString());
                }
            }
        }