Esempio n. 1
0
        private void BulkInvoiceButton_Click(object sender, RibbonControlEventArgs e)
        {
            DateRangeForm myForm = new DateRangeForm();

            myForm.ShowDialog();

            if (myForm.ToDate != null && myForm.FromDate != null)
            {
                DateTime dateFrom               = (DateTime)myForm.FromDate;
                DateTime dateTo                 = (DateTime)myForm.ToDate;
                string   query                  = String.Format("SELECT * FROM dbo.FPIBulkInvoice('{0}', '{1}')", dateFrom.ToString("yyyy-MM-dd"), dateTo.ToString("yyyy-MM-dd"));
                System.Data.DataTable   table   = XLSQL.ReturnTable(query);
                List <XLMain.FPIClient> clients = new List <XLMain.FPIClient>();
                foreach (System.Data.DataRow row in table.Rows)
                {
                    XLMain.FPIClient client = new XLMain.FPIClient(row);
                    clients.Add(client);
                }
                XLDocument.MergeFPIData(clients, forceNewDocument: true, asPdf: true, saveLocationForPdf: @"\\milsted-langdon\ml\ML\Facility\Admin\Admin - Common\FPI\FPI VAT Invoices\Bulk Invoices\");
            }
        }
        public override void Run()
        {
            ReportTitle = "Лог лицензий на ПО";
            var arguments = new Dictionary <string, string>
            {
                { "config", Path.Combine(LicenseSoftwareSettings.ActivityManagerConfigsPath, "log_licenses.xml") },
                { "connectionString", LicenseSoftwareSettings.ConnectionString }
            };

            using (var drForm = new DateRangeForm())
            {
                if (drForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    arguments.Add("date_from", drForm.DateFrom.ToString("dd.MM.yyyy", CultureInfo.InvariantCulture));
                    arguments.Add("date_to", drForm.DateTo.ToString("dd.MM.yyyy", CultureInfo.InvariantCulture));
                    base.Run(arguments);
                }
                else
                {
                    Cancel();
                }
            }
        }