Esempio n. 1
0
 private void ExpBtn_Click(object sender, EventArgs e)
 {
     QueryObject<Finance> query = new QueryObject<Finance>();
     query.Condition = new Finance();
     query.Condition.BeginTime = this.BeginDate.Value.ToString(Constants.DateFormat);
     query.Condition.EndTime = this.EndDate.Value.ToString(Constants.DateFormat);
     query.Condition.Description = this.Description.Text.Trim();
     query.Condition.EventType = (string)this.EventType.SelectedValue;
     query.Condition.ItemType = (string)this.ItemType.SelectedValue;
     query.Condition.Association = (string)this.Association.SelectedValue;
     query.Condition.ReceivePaymentor = this.ReceivePaymentor.Text.Trim();
     QueryObject<Finance> result = finOrderManager.GetFinances(query);
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     saveFileDialog1.Filter = "Excel工作簿(*.xls,*.xlsx)| *.xls; *.xlsx";
     saveFileDialog1.FilterIndex = 2;
     saveFileDialog1.RestoreDirectory = true;
     if (saveFileDialog1.ShowDialog() == DialogResult.OK)
     {
         string localFilePath = saveFileDialog1.FileName.ToString();
         try
         {
             ExportExcel exporter = new ExportExcel();
             exporter.AddColumn("FinDate", "日期");
             exporter.AddColumn("EventType", "收支类型");
             exporter.AddColumn("Description", "款项说明");
             exporter.AddColumn("Amount", "金额");
             exporter.AddColumn("Rate", "汇率");
             exporter.AddColumn("TotalAmount", "总金额");
             exporter.AddColumn("ReferenceNo", "流水号");
             exporter.AddColumn("ReceivePaymentor", "收付款单位");
             exporter.AddColumn("Association", "经手人/相关人");
             exporter.AddColumn("Remark", "备注");
             exporter.ExportToExcel<Finance>(result.Result, localFilePath);
             exporter.Dispose();
         }
         catch (Exception ex)
         {
             MessageBox.Show("保存文件出错:" + ex.Message);
         }
     }
 }
Esempio n. 2
0
        private void ExpBtn_Click(object sender, EventArgs e)
        {
            QueryObject<Order> query = GetQueryObject();
            QueryObject<Order> result = finOrderManager.GetOrders(query);

            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            saveFileDialog1.Filter = "Excel工作簿(*.xls,*.xlsx)| *.xls; *.xlsx";
            saveFileDialog1.FilterIndex = 2;
            saveFileDialog1.RestoreDirectory = true;
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string localFilePath = saveFileDialog1.FileName.ToString();
                try
                {
                    ExportExcel exporter = new ExportExcel();
                    exporter.AddColumn("BeginDate", "开始日期");
                    exporter.AddColumn("EndDate", "结束日期");
                    exporter.AddColumn("OrderNo", "订单编号");
                    exporter.AddColumn("Description", "订单描述");
                    exporter.AddColumn("SalesMan", "业务员");
                    exporter.AddColumn("Status", "订单状态");
                    if (!IsFinOrderView) {
                        exporter.AddColumn("Remark", "备注");
                    } else {
                        exporter.AddColumn("TotalAmount", "业务总金额");
                    }
                    exporter.ExportToExcel<Order>(result.Result, localFilePath);
                    exporter.Dispose();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("保存文件出错:" + ex.Message);
                }
            }
        }
Esempio n. 3
0
        private void FinDetailExpBtn_Click(object sender, EventArgs e)
        {
            QueryObject<FinDetails> query = new QueryObject<FinDetails>();
            query.IsExport = true;
            query.Condition = new FinDetails();
            query.Condition.BeginTime = this.BeginDateTxt.Value.ToString(Constants.DateFormat);
            query.Condition.EndTime = this.EndDateTxt.Value.ToString(Constants.DateFormat);
            query.Condition.Description = this.EventNameTxt.Text.Trim();
            query.Condition.EventType = (string)this.EventTypeTxt.SelectedValue;
            query.Condition.ItemType = (string)this.ItemTypeTxt.SelectedValue;
            query.Condition.OrderNo = this.OrderNoTxt.Text.Trim();
            query.Condition.Association = (string)this.AssociationTxt.SelectedValue;
            QueryObject<FinDetails> result = finOrderManager.GetFinDetails(query);

            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            saveFileDialog1.Filter = "Excel工作簿(*.xls,*.xlsx)| *.xls; *.xlsx";
            saveFileDialog1.FilterIndex = 2;
            saveFileDialog1.RestoreDirectory = true;
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string localFilePath = saveFileDialog1.FileName.ToString();
                try
                {
                    ExportExcel exporter = new ExportExcel();
                    exporter.AddColumn("FinDate","日期");
                    exporter.AddColumn("Description", "描述");
                    exporter.AddColumn("TotalAmount","金额");
                    exporter.AddColumn("OrderNo","所属业务");
                    exporter.AddColumn("ItemType","项目类型");
                    exporter.AddColumn("Association","经手人/相关人");
                    exporter.AddColumn("EventType","收支类型");
                    exporter.AddColumn("Remark","备注");
                    exporter.ExportToExcel<FinDetails>(result.Result, localFilePath);
                    exporter.Dispose();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("保存文件出错:" + ex.Message);
                }
            }
        }