Beispiel #1
0
        async private void CreateProductionReport(ProductionOrderClient productionOrder)
        {
            var companyClient = Utility.GetCompanyClientUserInstance(api.CompanyEntity);
            var getLogo       = await UtilDisplay.GetLogo(api);

            var productionOrderLines = await api.Query <ProductionOrderLineClient>(productionOrder);

            if (productionOrderLines != null && productionOrderLines.Length > 0)
            {
                var productionReportSource = new ProductionStandardReportClient(companyClient, productionOrder, productionOrderLines, getLogo, Uniconta.ClientTools.Localization.lookup("ProductionOrder"));
                var standardReportSrc      = new IProductionStandardReport[] { productionReportSource };
                var standardPrint          = new StandardPrintReport(api, standardReportSrc, (int)StandardReports.ProductionOrder);
                await standardPrint.InitializePrint();

                if (standardPrint?.Report != null)
                {
                    AddDockItem(TabControls.StandardPrintReportPage, new object[] { new DevExpress.XtraReports.UI.XtraReport[] { standardPrint.Report } },
                                string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("PrintPreview"), productionOrder.ProductionNumber));
                }
            }
            else
            {
                UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("NoLinesFound"), Uniconta.ClientTools.Localization.lookup("Warning"), MessageBoxButton.OK);
            }
        }
Beispiel #2
0
        async private void OpenOutlook()
        {
            try
            {
                busyIndicator.IsBusy      = true;
                busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("LaunchingWaitMsg");
                var    selectedAccount = ((DebtorTransPayment)dgDebtorTranOpenGrid.SelectedItem).Account;
                byte[] logo            = await UtilDisplay.GetLogo(api);

                var Comp = api.CompanyEntity;

                var companyClient = Comp.CreateUserType <CompanyClient>();
                StreamingManager.Copy(Comp, companyClient);

                lastMessage = null; // just to reload message in case it has changed
                LoadDataForReport();

                int indexDebtorEmailType = 0;

                if (string.IsNullOrEmpty(collectionType))
                {
                    indexDebtorEmailType = SelectCollectionType();
                }
                else
                {
                    indexDebtorEmailType = AppEnums.DebtorEmailType.IndexOf(collectionType);
                }
                if (indexDebtorEmailType == -1)
                {
                    return;
                }

                var debtor          = accountCache.Get(selectedAccount) as Uniconta.DataModel.Debtor;
                var debtorEmailType = (DebtorEmailType)indexDebtorEmailType;
                var date            = BasePage.GetSystemDefaultDate();
                var selectedAccountstatementList = statementList.Where(p => p.AccountNumber == selectedAccount);
                var paymentStandardReport        = await GeneratePrintReport(selectedAccountstatementList, companyClient, date, logo, debtorEmailType);

                if (paymentStandardReport != null && paymentStandardReport.Count() == 1)
                {
                    InvoicePostingPrintGenerator.OpenReportInOutlook(api, paymentStandardReport.First(), debtor, debtorEmailType);

                    //Update Last dateTime
                    UpdateDate(date, selectedAccountstatementList.FirstOrDefault()?.ChildRecords, debtorEmailType == DebtorEmailType.InterestNote ? true : false);
                }
            }
            catch (Exception ex)
            {
                UnicontaMessageBox.Show(ex.Message, Uniconta.ClientTools.Localization.lookup("Exception"));
            }
            finally { busyIndicator.IsBusy = false; }
        }
Beispiel #3
0
        async Task <PartnerInvDetails> GetInvData(PartnerInvoiceClient selecteditem)
        {
            PartnerInvDetails partnerInvDetails = new PartnerInvDetails();

            partnerInvDetails.InvoiceHeader = selecteditem;

            var subscriptionLines = await api.Query <SubscriptionInvoiceClient>(selecteditem);

            partnerInvDetails.InvoiceLines = subscriptionLines;

            var reseller      = selecteditem.Reseller;
            var rSellerClient = await api.Query <ResellerClient>();

            var partner = rSellerClient.Where(p => p.Pid == reseller).SingleOrDefault();

            partnerInvDetails.Reseller    = partner;
            partnerInvDetails.CompanyLogo = await UtilDisplay.GetLogo(api);

            partnerInvDetails.Language = session.User._Language;

            return(partnerInvDetails);
        }
Beispiel #4
0
        async private void PrintData()
        {
            busyIndicator.IsBusy      = true;
            busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("GeneratingPage");

            try
            {
                //Get Company related details

                byte[] logo = await UtilDisplay.GetLogo(api);

                var Comp = api.CompanyEntity;

                var companyClient = Comp.CreateUserType <CompanyClient>();
                StreamingManager.Copy(Comp, companyClient);

                lastMessage = null; // just to reload message in case it has changed
                LoadDataForReport();
#if SILVERLIGHT
                if (dgDebtorTranOpenGrid.SelectedItem != null)
                {
                    var selectedAccount = ((DebtorTransPayment)dgDebtorTranOpenGrid.SelectedItem).Account;
                    var selectedItem    = statementList.Where(p => p.AccountNumber == selectedAccount).First() as DebtorPaymentStatementList;

                    if (string.IsNullOrEmpty(collectionType))
                    {
                        CWCollectionLetter cwCollectionLetter = new CWCollectionLetter();
                        cwCollectionLetter.Closed += async delegate
                        {
                            if (cwCollectionLetter.DialogResult == true)
                            {
                                await PrintDebtorPaymentStatementPage(companyClient, logo, selectedItem, cwCollectionLetter.Result);
                            }
                        };
                        cwCollectionLetter.Show();
                    }
                    else
                    {
                        await PrintDebtorPaymentStatementPage(companyClient, logo, selectedItem, collectionType);
                    }
                }
#else
                int indexDebtorEmailType = 0;

                if (string.IsNullOrEmpty(collectionType))
                {
                    indexDebtorEmailType = SelectCollectionType();
                }
                else
                {
                    indexDebtorEmailType = AppEnums.DebtorEmailType.IndexOf(collectionType);
                }
                if (indexDebtorEmailType == -1)
                {
                    return;
                }

                var debtorEmailType = (DebtorEmailType)indexDebtorEmailType;
                var date            = BasePage.GetSystemDefaultDate();

                var xtraReports = await GeneratePrintReport(statementList, companyClient, date, logo, debtorEmailType);

                if (xtraReports.Count() > 0)
                {
                    var reportName = AddInterest ? Uniconta.ClientTools.Localization.lookup("InterestNote") : Uniconta.ClientTools.Localization.lookup("CollectionLetter");
                    var dockName   = string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Preview"), reportName);
                    AddDockItem(UnicontaTabs.StandardPrintReportPage, new object[] { xtraReports, reportName }, dockName);
                }
#endif
            }
            catch (Exception ex)
            {
                busyIndicator.IsBusy = false;
                api.ReportException(ex, string.Format("DebtorPayment.PrintData(), CompanyId={0}", api.CompanyId));
                UnicontaMessageBox.Show(ex);
            }
            finally
            {
                busyIndicator.IsBusy = false;
            }
        }
        async private void PrintData()
        {
            busyIndicator.IsBusy      = true;
            busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("GeneratingPage");

            try
            {
                //Get Company related details
                var companyClient = new CompanyClient();
                StreamingManager.Copy(api.CompanyEntity, companyClient);
                byte[] getLogoBytes = await UtilDisplay.GetLogo(api);

#if SILVERLIGHT
                if (dgDebtorTrans.SelectedItem != null)
                {
                    var selectedItem = dgDebtorTrans.SelectedItem as DebtorStatementList;
                    if (selectedItem.ChildRecords.Count == 0)
                    {
                        return;
                    }

                    var debt = new DebtorClient();
                    StreamingManager.Copy(selectedItem.deb, debt);
                    if (debt != null)
                    {
                        debt.Transactions = selectedItem.ChildRecords;

                        //Setting the Localization for the debtor
                        var debtLocalize = Uniconta.ClientTools.Localization.GetLocalization(UtilDisplay.GetLanguage(debt, api.CompanyEntity));
                        foreach (var rec in debt.Transactions)
                        {
                            rec.LocOb = debtLocalize;
                        }

                        var debtorMessageClient = await Utility.GetDebtorMessageClient(api, debt._Language, DebtorEmailType.AccountStatement);

                        string messageText = debtorMessageClient?._Text;

                        DebtorStatementCustomPrint dbStatementCustomPrint = new DebtorStatementCustomPrint(api, selectedItem, companyClient, debt,
                                                                                                           txtDateFrm.DateTime, txtDateTo.DateTime, getLogoBytes, messageText);

                        object[] obj = new object[1];
                        obj[0] = dbStatementCustomPrint as Controls.CustomPrintTemplateData;
                        if (chkShowCurrency.IsChecked == true)
                        {
                            AddDockItem(TabControls.DebtorStatementCurrencyCustomPrintPage, obj, true, string.Format("{0}: {1}, {2}", Uniconta.ClientTools.Localization.lookup("PrintPreview"), selectedItem.AccountNumber, selectedItem.Name));
                        }
                        else
                        {
                            AddDockItem(TabControls.DebtorStatementCustomPrintPage, obj, true, string.Format("{0}: {1}, {2}", Uniconta.ClientTools.Localization.lookup("PrintPreview"), selectedItem.AccountNumber, selectedItem.Name));
                        }
                    }
                }
#else
                IEnumerable <DebtorStatementList> debtorStatementList = (IEnumerable <DebtorStatementList>)dgDebtorTrans.ItemsSource;
                var layoutSelectedDebtorStatementList = new Dictionary <string, List <DebtorStatementList> >();

                var Comp           = api.CompanyEntity;
                var layoutgrpCache = Comp.GetCache(typeof(Uniconta.DataModel.DebtorLayoutGroup));
                if (layoutgrpCache == null)
                {
                    layoutgrpCache = await Comp.LoadCache(typeof(Uniconta.DataModel.DebtorLayoutGroup), api);
                }

                var xtraReports = new List <DevExpress.XtraReports.UI.XtraReport>();
                var iReports    = new List <IPrintReport>();
                var marked      = debtorStatementList.Any(m => m.Mark == true);

                foreach (var db in debtorStatementList)
                {
                    if (db.ChildRecords.Count == 0 || (marked && !db.Mark))
                    {
                        continue;
                    }

                    var statementPrint = await GenerateStandardStatementReport(companyClient, txtDateFrm.DateTime, txtDateTo.DateTime, db, getLogoBytes);

                    if (statementPrint == null)
                    {
                        continue;
                    }

                    var standardReports = new IDebtorStandardReport[1] {
                        statementPrint
                    };

                    IPrintReport standardPrint;
                    if (chkShowCurrency.IsChecked == true)
                    {
                        standardPrint = new StandardPrintReport(api, standardReports, (byte)Uniconta.ClientTools.Controls.Reporting.StandardReports.StatementCurrency);
                    }
                    else
                    {
                        standardPrint = new StandardPrintReport(api, standardReports, (byte)Uniconta.ClientTools.Controls.Reporting.StandardReports.Statement);
                    }
                    await standardPrint.InitializePrint();

                    if (standardPrint.Report != null)
                    {
                        iReports.Add(standardPrint);
                    }
                }

                if (iReports.Count > 0)
                {
                    var dockJName = string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Preview"), Uniconta.ClientTools.Localization.lookup("Statement"));
                    AddDockItem(UnicontaTabs.StandardPrintReportPage, new object[] { iReports, Uniconta.ClientTools.Localization.lookup("Statement") }, dockJName);
                }
#endif
            }
            catch (Exception ex)
            {
                busyIndicator.IsBusy = false;
                api.ReportException(ex, string.Format("DebtorStatement.PrintData(), CompanyId={0}", api.CompanyId));
                UnicontaMessageBox.Show(ex.Message, Uniconta.ClientTools.Localization.lookup("Exception"), MessageBoxButton.OK);
            }
            finally { busyIndicator.IsBusy = false; }
        }
        async private void PrintData()
        {
            busyIndicator.IsBusy      = true;
            busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("GeneratingPage");

            try
            {
#if SILVERLIGHT
                //Get Company related details
                var companyClient = new CompanyClient();
                StreamingManager.Copy(api.CompanyEntity, companyClient);
                byte[] getLogoBytes = await UtilDisplay.GetLogo(api);

                if (dgDebtorTrans.SelectedItem != null)
                {
                    var selectedItem = dgDebtorTrans.SelectedItem as DebtorStatementList;
                    if (selectedItem.ChildRecords.Length == 0)
                    {
                        return;
                    }

                    var debt = new DebtorClient();
                    StreamingManager.Copy(selectedItem.deb, debt);
                    debt.Transactions = selectedItem.ChildRecords;

                    //Setting the Localization for the debtor
                    var lan          = UtilDisplay.GetLanguage(debt, companyClient);
                    var debtLocalize = Uniconta.ClientTools.Localization.GetLocalization(lan);
                    foreach (var rec in debt.Transactions)
                    {
                        rec.LocOb = debtLocalize;
                        if (rec._Primo)
                        {
                            rec._Text = debtLocalize.Lookup("Primo");
                        }
                    }

                    if (lastMessage == null || messageLanguage != lan)
                    {
                        messageLanguage = lan;
                        var msg = await Utility.GetDebtorMessageClient(api, lan, DebtorEmailType.AccountStatement);

                        if (msg != null)
                        {
                            lastMessage = msg._Text;
                        }
                        else
                        {
                            lastMessage = string.Empty;
                        }
                    }

                    DebtorStatementCustomPrint dbStatementCustomPrint = new DebtorStatementCustomPrint(api, selectedItem, companyClient, debt,
                                                                                                       txtDateFrm.DateTime, txtDateTo.DateTime, getLogoBytes, lastMessage);

                    object[] obj = new object[1];
                    obj[0] = dbStatementCustomPrint as Controls.CustomPrintTemplateData;
                    if (chkShowCurrency.IsChecked == true)
                    {
                        AddDockItem(TabControls.DebtorStatementCurrencyCustomPrintPage, obj, true, string.Format("{0}: {1}, {2}", Uniconta.ClientTools.Localization.lookup("PrintPreview"), selectedItem.AccountNumber, selectedItem.Name));
                    }
                    else
                    {
                        AddDockItem(TabControls.DebtorStatementCustomPrintPage, obj, true, string.Format("{0}: {1}, {2}", Uniconta.ClientTools.Localization.lookup("PrintPreview"), selectedItem.AccountNumber, selectedItem.Name));
                    }
                }
#else
                var debtorStatementList = dgDebtorTrans.VisibleItems.Cast <DebtorStatementList>();
                var marked = debtorStatementList.Any(m => m.Mark == true);

                var iReports = await GeneratePrintReport(debtorStatementList.ToList(), marked, chkShowCurrency.IsChecked == true, true);

                if (iReports.Count() > 0)
                {
                    var dockJName = string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Preview"), Uniconta.ClientTools.Localization.lookup("Statement"));
                    AddDockItem(UnicontaTabs.StandardPrintReportPage, new object[] { iReports, Uniconta.ClientTools.Localization.lookup("Statement") }, dockJName);
                }
#endif
            }
            catch (Exception ex)
            {
                busyIndicator.IsBusy = false;
                api.ReportException(ex, string.Format("DebtorStatement.PrintData(), CompanyId={0}", api.CompanyId));
                UnicontaMessageBox.Show(ex);
            }
            finally { busyIndicator.IsBusy = false; }
        }
        async private Task <IEnumerable <IPrintReport> > GeneratePrintReport(IEnumerable <DebtorStatementList> statementList, bool marked, bool hasCurrency, bool applyGridFilter)
        {
            var iprintReportList = new List <IPrintReport>();

            //Get Company related details

            var companyClient = api.CompanyEntity.CreateUserType <CompanyClient>();

            StreamingManager.Copy(api.CompanyEntity, companyClient);
            byte[] getLogoBytes = await UtilDisplay.GetLogo(api);

            int rowHandle = -1;

            foreach (var db in statementList)
            {
                rowHandle = rowHandle + 1;

                if (db.ChildRecords.Length == 0 || (marked && !db.Mark))
                {
                    continue;
                }

                if (applyGridFilter)
                {
                    var visibelDetails = dgDebtorTrans.GetVisibleDetail(rowHandle);
                    if (visibelDetails == null || visibelDetails.VisibleItems?.Count == 0)
                    {
                        continue;
                    }
                }

                var lan = UtilDisplay.GetLanguage(db.deb, companyClient);

                //Setting the Localization for the debtor
                var debtLocalize = Uniconta.ClientTools.Localization.GetLocalization(lan);
                foreach (var rec in db.ChildRecords)
                {
                    rec.LocOb = debtLocalize;
                    if (rec._Primo)
                    {
                        rec._Text = debtLocalize.Lookup("Primo");
                    }
                }

                var debtorType = Uniconta.Reports.Utilities.ReportUtil.GetUserType(typeof(DebtorClient), api.CompanyEntity);
                var debt       = Activator.CreateInstance(debtorType) as DebtorClient;
                StreamingManager.Copy(db.deb, debt);
                debt.Transactions = applyGridFilter ? dgDebtorTrans.GetVisibleDetail(rowHandle).VisibleItems.Cast <DebtorTransClientTotal>() : db.ChildRecords;

                if (lastMessage == null || messageLanguage != lan)
                {
                    messageLanguage = lan;
                    var msg = await Utility.GetDebtorMessageClient(api, lan, DebtorEmailType.AccountStatement);

                    if (msg != null)
                    {
                        lastMessage = msg._Text;
                    }
                    else
                    {
                        lastMessage = string.Empty;
                    }
                }

                var statementPrint  = new DebtorStatementReportClient(companyClient, debt, txtDateFrm.DateTime, txtDateTo.DateTime, "Statement", getLogoBytes, lastMessage);
                var standardReports = new[] { statementPrint };
                var standardPrint   = new StandardPrintReport(api, standardReports, hasCurrency ? (byte)Uniconta.ClientTools.Controls.Reporting.StandardReports.StatementCurrency : (byte)Uniconta.ClientTools.Controls.Reporting.StandardReports.Statement);
                await standardPrint.InitializePrint();

                if (standardPrint.Report != null)
                {
                    iprintReportList.Add(standardPrint);
                }
            }
            return(iprintReportList);
        }
Beispiel #8
0
        async private void PrintData()
        {
            busyIndicator.IsBusy      = true;
            busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("GeneratingPage");

            try
            {
                //Get Company related details

                byte[] logo = await UtilDisplay.GetLogo(api);

                var Comp = api.CompanyEntity;

                var companyClient = new CompanyClient();
                StreamingManager.Copy(api.CompanyEntity, companyClient);

                LoadDataForReport();
#if SILVERLIGHT
                if (dgDebtorTranOpenGrid.SelectedItem != null)
                {
                    var selectedAccount = ((DebtorTransPayment)dgDebtorTranOpenGrid.SelectedItem).Account;
                    var selectedItem    = statementList.Where(p => p.AccountNumber == selectedAccount).First() as DebtorPaymentStatementList;
                    if (selectedItem.ChildRecords.Count == 0)
                    {
                        return;
                    }

                    if (string.IsNullOrEmpty(collectionType))
                    {
                        CWCollectionLetter cwCollectionLetter = new CWCollectionLetter();
                        cwCollectionLetter.Closed += async delegate
                        {
                            if (cwCollectionLetter.DialogResult == true)
                            {
                                await PrintDebtorPaymentStatementPage(companyClient, logo, selectedItem, cwCollectionLetter.Result);
                            }
                        };
                        cwCollectionLetter.Show();
                    }
                    else
                    {
                        await PrintDebtorPaymentStatementPage(companyClient, logo, selectedItem, collectionType);
                    }
                }
#else
                var layoutSelectedDebtorCollectionList = new Dictionary <string, List <IDebtorStandardReport> >();
                var comp           = api.CompanyEntity;
                var layoutgrpCache = comp.GetCache(typeof(DebtorLayoutGroup)) ?? await comp.LoadCache(typeof(DebtorLayoutGroup), api);

                var xtraReports = new List <IPrintReport>();

                int indexDebtorEmailType = 0;

                if (string.IsNullOrEmpty(collectionType))
                {
                    indexDebtorEmailType = SelectCollectionType();
                }
                else
                {
                    indexDebtorEmailType = AppEnums.DebtorEmailType.IndexOf(collectionType);
                }
                if (indexDebtorEmailType == -1)
                {
                    return;
                }

                var debtorEmailType = (DebtorEmailType)indexDebtorEmailType;

                foreach (var debt in statementList.ToList())
                {
                    var selectedItem = debt as DebtorPaymentStatementList;
                    if (selectedItem.ChildRecords.Count == 0)
                    {
                        continue;
                    }

                    var collectionPrint = await GenerateStandardCollectionReport(companyClient, BasePage.GetSystemDefaultDate(), selectedItem, logo, debtorEmailType);

                    if (collectionPrint == null)
                    {
                        continue;
                    }

                    var standardReports = new IDebtorStandardReport[1] {
                        collectionPrint
                    };

                    IPrintReport standardPrint;
                    if (this.AddInterest)
                    {
                        standardPrint = new StandardPrintReport(api, standardReports, (byte)Uniconta.ClientTools.Controls.Reporting.StandardReports.InterestNote);
                    }
                    else
                    {
                        standardPrint = new StandardPrintReport(api, standardReports, (byte)Uniconta.ClientTools.Controls.Reporting.StandardReports.CollectionLetter);
                    }
                    await standardPrint.InitializePrint();

                    if (standardPrint.Report != null)
                    {
                        xtraReports.Add(standardPrint);
                    }
                }

                if (xtraReports.Count > 0)
                {
                    var reportName = AddInterest ? Uniconta.ClientTools.Localization.lookup("InterestNote") : Uniconta.ClientTools.Localization.lookup("CollectionLetter");
                    var dockName   = string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Preview"), reportName);
                    AddDockItem(UnicontaTabs.StandardPrintReportPage, new object[] { xtraReports, reportName }, dockName);
                }
#endif
            }
            catch (Exception ex)
            {
                busyIndicator.IsBusy = false;
                api.ReportException(ex, string.Format("DebtorPayment.PrintData(), CompanyId={0}", api.CompanyId));
                UnicontaMessageBox.Show(ex.Message, Uniconta.ClientTools.Localization.lookup("Exception"), MessageBoxButton.OK);
            }
            finally
            {
                busyIndicator.IsBusy = false;
            }
        }