예제 #1
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

        public static bool PrintWorkSessionMovement(sys_configurationprinters pPrinter, pos_worksessionperiod pWorkSessionPeriod)
        {
            bool result = false;

            if (pPrinter != null)
            {
                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":
                        //NonCurrentAcount
                        ThermalPrinterInternalDocumentWorkSession thermalPrinterInternalDocumentWorkSession = new ThermalPrinterInternalDocumentWorkSession(pPrinter, pWorkSessionPeriod, SplitCurrentAccountMode.NonCurrentAcount);
                        thermalPrinterInternalDocumentWorkSession.Print();
                        //CurrentAcount
                        //Use Config to print this
                        if (Convert.ToBoolean(GlobalFramework.PreferenceParameters["USE_CC_DAILY_TICKET"]))
                        {
                            thermalPrinterInternalDocumentWorkSession = new ThermalPrinterInternalDocumentWorkSession(pPrinter, pWorkSessionPeriod, SplitCurrentAccountMode.CurrentAcount);
                            thermalPrinterInternalDocumentWorkSession.Print();
                        }
                        break;

                    case "GENERIC_PRINTER_WINDOWS":
                        break;

                    case "REPORT_EXPORT_PDF":
                        break;
                    }
                    result = true;
                }
                catch (Exception ex)
                {
                    _log.Warn(ex.Message, ex);
                    throw new Exception(ex.Message);
                }
            }
            return(result);
        }
예제 #2
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

        public static bool PrintWorkSessionMovement(SYS_ConfigurationPrinters pPrinter, POS_WorkSessionPeriod pWorkSessionPeriod)
        {
            bool result = false;

            if (pPrinter != null)
            {
                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":
                        //NonCurrentAcount
                        ThermalPrinterInternalDocumentWorkSession thermalPrinterInternalDocumentWorkSession = new ThermalPrinterInternalDocumentWorkSession(pPrinter, pWorkSessionPeriod, SplitCurrentAccountMode.NonCurrentAcount);
                        thermalPrinterInternalDocumentWorkSession.Print();
                        //CurrentAcount
                        thermalPrinterInternalDocumentWorkSession = new ThermalPrinterInternalDocumentWorkSession(pPrinter, pWorkSessionPeriod, SplitCurrentAccountMode.CurrentAcount);
                        thermalPrinterInternalDocumentWorkSession.Print();
                        break;

                    case "GENERIC_PRINTER_WINDOWS":
                        break;

                    case "REPORT_EXPORT_PDF":
                        break;
                    }
                    result = true;
                }
                catch (Exception ex)
                {
                    _log.Warn(ex.Message, ex);
                    throw new Exception(ex.Message);
                }
            }
            return(result);
        }
예제 #3
0
        public static void Print(SYS_ConfigurationPrinters pPrinter)
        {
            try
            {
                //Parameters
                POS_WorkSessionPeriod workSessionPeriod = (POS_WorkSessionPeriod)GlobalFramework.SessionXpo.GetObjectByKey(typeof(POS_WorkSessionPeriod), SettingsApp.XpoPrintWorkSessionPeriod);

                //Print WorkSession
                if (workSessionPeriod != null)
                {
                    //Get Filter Field : To filter Day or Terminal
                    string periodField = (workSessionPeriod.PeriodType == WorkSessionPeriodType.Day) ? "wspPeriodParent" : "wspPeriod";

                    string sqlShared = @"
                        SELECT 
                            COUNT(*) as Count
                        FROM 
                            view_worksessionmovement 
                        WHERE
                            (dfmDocument IS NOT NULL AND wmtMovementTypeToken = 'FINANCE_DOCUMENT')  
                            AND {0} = '{1}' 
                            AND wsmDocumentFinanceType {2} '{3}';
                    ";

                    //Generate Queries
                    string sqlNonCurrentAccount = string.Format(sqlShared, periodField, workSessionPeriod.Oid, "<>", SettingsApp.XpoOidDocumentFinanceTypeCurrentAccountInput);
                    string sqlCurrentAccount    = string.Format(sqlShared, periodField, workSessionPeriod.Oid, "=", SettingsApp.XpoOidDocumentFinanceTypeCurrentAccountInput);
                    //Get Queries Results
                    object totRecsNonCurrentAccount = GlobalFramework.SessionXpo.ExecuteScalar(sqlNonCurrentAccount);
                    object totRecsCurrentAccount    = GlobalFramework.SessionXpo.ExecuteScalar(sqlCurrentAccount);
                    //Shared
                    ThermalPrinterInternalDocumentWorkSession thermalPrinterInternalDocumentWorkSession;
                    //Tests
                    bool printSplitCurrentAccountModeNonCurrentAcount = true;
                    bool printSplitCurrentAccountModeCurrentAcount    = true;
                    bool printSplitCurrentAccountModeAll = true;

                    //Test Print Document
                    //Always print NonCurrent Account Movements, even if dont have any Movements, Show zero values
                    if (printSplitCurrentAccountModeNonCurrentAcount)
                    {
                        thermalPrinterInternalDocumentWorkSession = new ThermalPrinterInternalDocumentWorkSession(pPrinter, workSessionPeriod, SplitCurrentAccountMode.NonCurrentAcount);
                        thermalPrinterInternalDocumentWorkSession.Print();
                    }

                    //Test Combine NonCC and CC (All)
                    if (printSplitCurrentAccountModeAll)
                    {
                        thermalPrinterInternalDocumentWorkSession = new ThermalPrinterInternalDocumentWorkSession(pPrinter, workSessionPeriod, SplitCurrentAccountMode.All);
                        thermalPrinterInternalDocumentWorkSession.Print();
                    }

                    //Only Prints Current Account Movements if if Has Movements
                    if (printSplitCurrentAccountModeCurrentAcount && Convert.ToInt16(totRecsCurrentAccount) > 0)
                    {
                        thermalPrinterInternalDocumentWorkSession = new ThermalPrinterInternalDocumentWorkSession(pPrinter, workSessionPeriod, SplitCurrentAccountMode.CurrentAcount);
                        thermalPrinterInternalDocumentWorkSession.Print();
                    }

                    Console.WriteLine("ThermalPrinterInternalDocumentWorkSession Printed");
                }
                else
                {
                    Console.WriteLine("ERROR: ThermalPrinterInternalDocumentWorkSession");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }