示例#1
0
        private void Merge3Btn_Click(object sender, RibbonControlEventArgs e)
        {
            XLForms.StaffSelectForm staffForm = new XLForms.StaffSelectForm();
            staffForm.ShowDialog();
            Document currentDoc             = XLDocument.GetCurrentDoc();
            long     startPosition          = currentDoc.Content.Start;
            long     endPosition            = currentDoc.Content.End;
            string   templateXML            = XLDocument.CopyRangeToWordXML(currentDoc.Range());
            List <XLMain.FPIClient> clients = XLMain.FPIClient.GetFPIClients(staffForm.selectedStaff.crmID, "where direct_debit = 0 and Last_year = 1");

            if (clients.Count > 0)
            {
                XLDocument.MergeFPIData(clients.OrderBy(c => c.office).ToList(), templateXML);
            }
            else
            {
                MessageBox.Show("No clients founds to merge.");
            }
            clients = XLMain.FPIClient.GetFPIClients(staffForm.selectedStaff.crmID, "where direct_debit = 0 and Last_year = 1", false);
            if (clients.Count > 0)
            {
                XLDocument.MergeFPIData(clients.OrderBy(c => c.office).ToList(), templateXML);
            }
            else
            {
                MessageBox.Show("No foreign clients founds to merge.");
            }
        }
示例#2
0
        private void InvoiceBtn_Click(object sender, RibbonControlEventArgs e)
        {
            XLForms.ClientForm clientForm = new XLForms.ClientForm();
            clientForm.ShowDialog();

            if (clientForm.selectedClient != null)
            {
                XLMain.Client           client     = clientForm.selectedClient;
                XLMain.FPIClient        fpiClient  = XLMain.FPIClient.GetFPIClientInvoice(client);
                List <XLMain.FPIClient> clientList = new List <XLMain.FPIClient>();
                clientList.Add(fpiClient);
                XLDocument.MergeFPIData(clientList.OrderBy(c => c.office).ToList());
            }
        }
示例#3
0
        private void Merge4Btn_Click(object sender, RibbonControlEventArgs e)
        {
            XLForms.ClientForm clientForm = new XLForms.ClientForm();
            clientForm.ShowDialog();

            if (clientForm.selectedClient != null)
            {
                XLMain.Client           client  = clientForm.selectedClient;
                List <XLMain.FPIClient> clients = XLMain.FPIClient.GetFPIClients(client);
                if (clients.Count > 0)
                {
                    XLDocument.MergeFPIData(clients.OrderBy(c => c.office).ToList());
                }
                else
                {
                    MessageBox.Show("No clients founds to merge.");
                }
            }
        }
示例#4
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\");
            }
        }