Exemple #1
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

        public static bool PrintFinanceDocument(SYS_ConfigurationPrinters pPrinter, FIN_DocumentFinanceMaster pDocumentFinanceMaster, List <int> pCopyNames, bool pSecondCopy, string pMotive)
        {
            bool result = false;

            if (pPrinter != null)
            {
                //Init Helper Vars
                bool resultSystemPrint = false;
                int  printCopies       = pCopyNames.Count;
                //Get Hash4Chars from Hash
                string hash4Chars = ProcessFinanceDocument.GenDocumentHash4Chars(pDocumentFinanceMaster.Hash);

                try
                {
                    switch (GetPrinterToken(pPrinter.PrinterType.Token))
                    {
                    //Impressora SINOCAN em ambiente Windows
                    case "THERMAL_PRINTER_WINDOWS":
                    //Impressora SINOCAN em ambiente Linux
                    case "THERMAL_PRINTER_LINUX":
                    //Impressora SINOCAN em ambiente WindowsLinux/Socket
                    case "THERMAL_PRINTER_SOCKET":
                    //Impressora SINOCAN em ambiente WindowsLinux/USB
                    case "THERMAL_PRINTER_USB":
                        ThermalPrinterFinanceDocumentMaster thermalPrinterFinanceDocument = new ThermalPrinterFinanceDocumentMaster(pPrinter, pDocumentFinanceMaster, pCopyNames, pSecondCopy, pMotive);
                        thermalPrinterFinanceDocument.Print();
                        //Add to SystemPrint Audit
                        resultSystemPrint = SystemPrintInsert(pDocumentFinanceMaster, pPrinter.Designation, printCopies, pCopyNames, pSecondCopy, pMotive);
                        break;

                    case "GENERIC_PRINTER_WINDOWS":
                        CustomReport.ProcessReportFinanceDocument(CustomReportDisplayMode.Print, pDocumentFinanceMaster.Oid, hash4Chars, pCopyNames, pSecondCopy, pMotive);
                        //Add to SystemPrint Audit
                        resultSystemPrint = SystemPrintInsert(pDocumentFinanceMaster, pPrinter.Designation, printCopies, pCopyNames, pSecondCopy, pMotive);
                        break;

                    case "REPORT_EXPORT_PDF":
                        CustomReport.ProcessReportFinanceDocument(CustomReportDisplayMode.ExportPDF, pDocumentFinanceMaster.Oid, hash4Chars, pCopyNames, pSecondCopy, pMotive);
                        //Add to SystemPrint Audit : Developer : Use here Only to Test SystemPrintInsert
                        resultSystemPrint = SystemPrintInsert(pDocumentFinanceMaster, pPrinter.Designation, printCopies, pCopyNames, pSecondCopy, pMotive);
                        break;
                    }
                    result = true;
                }
                catch (Exception ex)
                {
                    _log.Warn(ex.Message, ex);
                    throw new Exception(ex.Message);
                }
            }

            return(result);
        }
Exemple #2
0
        //Override Parent Template
        public override void PrintContent()
        {
            try
            {
                //Call base PrintDocumentMaster();
                base.PrintDocumentMaster(_documentFinanceMasterList[0].DocumentTypeResourceString, _documentFinanceMasterList[0].DocumentNumber, _documentFinanceMasterList[0].DocumentDate);

                //Call
                PrintDocumentMasterDocumentType();

                //Call base PrintCustomer();
                base.PrintCustomer(
                    _documentFinanceMasterList[0].EntityName,
                    _documentFinanceMasterList[0].EntityAddress,
                    _documentFinanceMasterList[0].EntityZipCode,
                    _documentFinanceMasterList[0].EntityCity,
                    _documentFinanceMasterList[0].EntityCountry,
                    _documentFinanceMasterList[0].EntityFiscalNumber
                    );

                PrintDocumentDetails();
                PrintMasterTotals();
                PrintMasterTotalTax();
                PrintDocumenWayBillDetails();

                //Call base PrintDocumentPaymentDetails();
                base.PrintDocumentPaymentDetails(string.Empty, _documentFinanceMasterList[0].PaymentMethodDesignation, _documentFinanceMasterList[0].CurrencyAcronym); /* IN009055 */

                //Call base PrintNotes();
                //IN009279 Wont print notes on ticket mode
                if (_documentFinanceMasterList[0].Notes != null && !GlobalFramework.AppUseParkingTicketModule)
                {
                    base.PrintNotes(_documentFinanceMasterList[0].Notes.ToString());
                }

                //Only Print if is in Portugal ex "Os artigos faturados...."
                //Call base PrintDocumentTypeFooterString();
                if (SettingsApp.ConfigurationSystemCountry.Oid == SettingsApp.XpoOidConfigurationCountryPortugal || SettingsApp.ConfigurationSystemCountry.Oid == SettingsApp.XpoOidConfigurationCountryAngola)
                {
                    base.PrintDocumentTypeFooterString(_documentFinanceMasterList[0].DocumentTypeResourceStringReport);
                }

                //Get Hash4Chars from Hash
                string hash4Chars = ProcessFinanceDocument.GenDocumentHash4Chars(_documentMaster.Hash);
                //Call Base CertificationText
                base.PrintCertificationText(hash4Chars);
            }
            catch (Exception ex)
            {
                _log.Debug("override void PrintContent() :: Thermal Printer: " + ex.Message, ex);
                throw ex;
            }
        }
        //Override Parent Template
        public override void PrintContent()
        {
            try
            {
                //Call base PrintDocumentMaster();
                base.PrintDocumentMaster(_documentFinanceMasterList[0].DocumentTypeResourceString, _documentFinanceMasterList[0].DocumentNumber, _documentFinanceMasterList[0].DocumentDate);

                //Call
                PrintDocumentMasterDocumentType();

                //Call base PrintCustomer();
                base.PrintCustomer(
                    _documentFinanceMasterList[0].EntityName,
                    _documentFinanceMasterList[0].EntityAddress,
                    _documentFinanceMasterList[0].EntityZipCode,
                    _documentFinanceMasterList[0].EntityCity,
                    _documentFinanceMasterList[0].EntityCountry,
                    _documentFinanceMasterList[0].EntityFiscalNumber
                    );

                PrintDocumentDetails();
                PrintMasterTotals();
                PrintMasterTotalTax();
                PrintDocumenWayBillDetails();

                //Call base PrintDocumentPaymentDetails();
                base.PrintDocumentPaymentDetails(_documentFinanceMasterList[0].PaymentConditionDesignation, _documentFinanceMasterList[0].PaymentMethodDesignation, _documentFinanceMasterList[0].CurrencyAcronym);

                //Call base PrintNotes();
                if (_documentFinanceMasterList[0].Notes != null)
                {
                    base.PrintNotes(_documentFinanceMasterList[0].Notes.ToString());
                }

                //Only Print if is in Portugal ex "Os artigos faturados...."
                //Call base PrintDocumentTypeFooterString();
                if (SettingsApp.ConfigurationSystemCountry.Oid == SettingsApp.XpoOidConfigurationCountryPortugal)
                {
                    base.PrintDocumentTypeFooterString(_documentFinanceMasterList[0].DocumentTypeResourceStringReport);
                }

                //Get Hash4Chars from Hash
                string hash4Chars = ProcessFinanceDocument.GenDocumentHash4Chars(_documentMaster.Hash);
                //Call Base CertificationText
                base.PrintCertificationText(hash4Chars);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #4
0
        //public static string DocumentMasterCreatePDF(DocumentFinanceMaster pDocumentFinanceMaster, string pDestinationFileName, CustomReportDisplayMode pCustomReportDisplayMode)
        public static string DocumentMasterCreatePDF(CustomReportDisplayMode pViewMode, FIN_DocumentFinanceMaster pDocumentFinanceMaster, string pDestinationFileName)
        {
            string result = String.Empty;

            try
            {
                //Generate Default CopyNames from DocumentType
                List <int> copyNames  = CopyNames(pDocumentFinanceMaster.DocumentType.PrintCopies);
                string     hash4Chars = ProcessFinanceDocument.GenDocumentHash4Chars(pDocumentFinanceMaster.Hash);
                result = ProcessReportFinanceDocument(pViewMode, pDocumentFinanceMaster.Oid, hash4Chars, copyNames, pDestinationFileName);
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
            return(result);
        }
Exemple #5
0
        // Test Document Report
        void TestDocumentReport()
        {
            Guid docOid = new Guid("6d44b0a8-6450-4245-b4ee-a6e971f4bcec");
            FIN_DocumentFinanceMaster documentFinanceMaster = (FIN_DocumentFinanceMaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_DocumentFinanceMaster), docOid);

            if (documentFinanceMaster != null)
            {
                //Generate Default CopyNames from DocumentType
                List <int> copyNames           = CustomReport.CopyNames(documentFinanceMaster.DocumentType.PrintCopies);
                string     hash4Chars          = ProcessFinanceDocument.GenDocumentHash4Chars(documentFinanceMaster.Hash);
                string     destinationFileName = "";
                string     result = CustomReport.ProcessReportFinanceDocument(CustomReportDisplayMode.Design, documentFinanceMaster.Oid, hash4Chars, copyNames, destinationFileName);
                _log.Debug(String.Format("Result: [{0}]", result));
            }
            else
            {
                _log.Debug(String.Format("Null Document Found for documentType: [{0}]", nameof(FIN_DocumentFinanceMaster), docOid.ToString()));
            }
        }