Example #1
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //ExportSaftPt

        public static string ExportSaft(Window pSourceWindow, ExportSaftPtMode pExportSaftPtMode)
        {
            string   result = string.Empty;
            DateTime dateCurrent = FrameworkUtils.CurrentDateTimeAtomic();
            DateTime dateStart, dateEnd;

            switch (pExportSaftPtMode)
            {
            case ExportSaftPtMode.WholeYear:
                dateStart = new DateTime(dateCurrent.Year, 1, 1);
                dateEnd   = new DateTime(dateCurrent.Year, 12, 31);
                result    = ExportSaft(pSourceWindow, dateStart, dateEnd);
                break;

            case ExportSaftPtMode.LastMonth:
                dateStart = dateCurrent.AddMonths(-1);
                dateStart = new DateTime(dateStart.Year, dateStart.Month, 1);
                dateEnd   = dateStart.AddMonths(1).AddDays(-1);
                result    = ExportSaft(pSourceWindow, dateStart, dateEnd);
                break;

            case ExportSaftPtMode.Custom:
                PosDatePickerStartEndDateDialog dialog = new PosDatePickerStartEndDateDialog(pSourceWindow, Gtk.DialogFlags.DestroyWithParent);
                ResponseType response = (ResponseType)dialog.Run();
                if (response == ResponseType.Ok)
                {
                    result = ExportSaft(pSourceWindow, dialog.DateStart, dialog.DateEnd);
                }
                dialog.Destroy();
                break;
            }

            return(result);
        }
Example #2
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //ExportSaftPt

        public static string ExportSaftPt(Window pSourceWindow, ExportSaftPtMode pExportSaftPtMode)
        {
            string   result = string.Empty;
            DateTime dateCurrent = FrameworkUtils.CurrentDateTimeAtomic();
            DateTime dateStart, dateEnd;

            // Plugin Errors Messages
            if (GlobalFramework.PluginSoftwareVendor == null || !GlobalFramework.PluginSoftwareVendor.IsValidSecretKey(SettingsApp.SecretKey))
            {
                /* IN009034 */
                GlobalApp.DialogThreadNotify.WakeupMain();

                _log.Debug(String.Format("void Init() :: Wrong key detected [{0}]. Use a valid LogicposFinantialLibrary with same key as SoftwareVendorPlugin", SettingsApp.SecretKey));
                Utils.ShowMessageTouch(GlobalApp.WindowStartup, DialogFlags.Modal, new Size(650, 380), MessageType.Error, ButtonsType.Ok, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_error"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_error_plugin_softwarevendor_not_registered"));
            }
            else
            {
                switch (pExportSaftPtMode)
                {
                case ExportSaftPtMode.WholeYear:
                    dateStart = new DateTime(dateCurrent.Year, 1, 1);
                    dateEnd   = new DateTime(dateCurrent.Year, 12, 31);
                    result    = ExportSaftPt(pSourceWindow, dateStart, dateEnd);
                    break;

                case ExportSaftPtMode.LastMonth:
                    dateStart = dateCurrent.AddMonths(-1);
                    dateStart = new DateTime(dateStart.Year, dateStart.Month, 1);
                    dateEnd   = dateStart.AddMonths(1).AddDays(-1);
                    result    = ExportSaftPt(pSourceWindow, dateStart, dateEnd);
                    break;

                case ExportSaftPtMode.Custom:
                    PosDatePickerStartEndDateDialog dialog = new PosDatePickerStartEndDateDialog(pSourceWindow, Gtk.DialogFlags.DestroyWithParent);
                    ResponseType response = (ResponseType)dialog.Run();
                    if (response == ResponseType.Ok)
                    {
                        result = ExportSaftPt(pSourceWindow, dialog.DateStart, dialog.DateEnd);
                    }
                    dialog.Destroy();
                    break;
                }
            }

            return(result);
        }