public void Insert(string CompanyName, string PhoneNumber, string LicenseCode, string Address, string SubCompanyNumber, string SubCompanyName, string Postalcode, string ShopHours, string StartTicketNumber, string SetupDate) { DDCompanyInfo item = new DDCompanyInfo(); item.CompanyName = CompanyName; item.PhoneNumber = PhoneNumber; item.LicenseCode = LicenseCode; item.Address = Address; item.SubCompanyNumber = SubCompanyNumber; item.SubCompanyName = SubCompanyName; item.Postalcode = Postalcode; item.ShopHours = ShopHours; item.StartTicketNumber = StartTicketNumber; item.SetupDate = SetupDate; item.Save(UserName); }
public void Update(int CompanyID, string CompanyName, string PhoneNumber, string LicenseCode, string Address, string SubCompanyNumber, string SubCompanyName, string Postalcode, string ShopHours, string StartTicketNumber, string SetupDate) { DDCompanyInfo item = new DDCompanyInfo(); item.MarkOld(); item.IsLoaded = true; item.CompanyID = CompanyID; item.CompanyName = CompanyName; item.PhoneNumber = PhoneNumber; item.LicenseCode = LicenseCode; item.Address = Address; item.SubCompanyNumber = SubCompanyNumber; item.SubCompanyName = SubCompanyName; item.Postalcode = Postalcode; item.ShopHours = ShopHours; item.StartTicketNumber = StartTicketNumber; item.SetupDate = SetupDate; item.Save(UserName); }
private void LoadCompanyInfo(int intCompanyID) { DDCompanyInfo company = new DDCompanyInfo("CompanyID", intCompanyID); this.tbxCompanyName.Text = company.CompanyName; this.tbxCompanyPhone.Text = company.PhoneNumber; this.tbxCompanyAdd.Text = company.Address; this.tbxLicenseCode.Text = company.LicenseCode; }
public MainForm() { InitializeComponent(); InitializeOutlookbar(); //CreatePawnForm frmCreatePawn = new CreatePawnForm(); //frmCreatePawn.Show(this.dockPanel1); //pCurrentWin = this; //读取精度和计费模式 DDCompanyInfo newCompanyInfo = new DDCompanyInfo("CompanyID", 0); AmountAccuracy = Convert.ToInt32(newCompanyInfo.AmountAccuracy); CountDayMode = newCompanyInfo.CountDayMode; skinh = new SkinH_Net(); skinh.Attach(); }
private void LoadCompanyInfo() { DDCompanyInfo company = new DDCompanyInfo("CompanyID", 1); DDGeneralParemeter newParem = new DDGeneralParemeter("ParamName", "CurrentTicketNumber"); this.tbxCompanyName.Text = company.CompanyName; this.tbxLicenseCode.Text = company.LicenseCode; this.tbxSubCompanyNumber.Text = company.SubCompanyNumber; this.tbxSubCompanyName.Text = company.SubCompanyName; this.tbxCompanyAdd.Text = company.Address; this.tbxCompanyPhone.Text = company.PhoneNumber; this.tbxPostalCode.Text = company.Postalcode; this.tbxShopHours.Text = company.ShopHours; this.tbxSetupDate.Text = company.SetupDate; this.tbxStartTicketNumber.Text = company.StartTicketNumber; this.cbxAmountAccuracy.SelectedIndex = Convert.ToInt32(company.AmountAccuracy); this.cbxCountDayMode.SelectedIndex = Convert.ToInt32(company.CountDayMode); this.tbxTicketNumber.Text = newParem.ParamValue; }
private void btnUpdate_Click(object sender, EventArgs e) { DDCompanyInfo company = new DDCompanyInfo("CompanyID", 1); DDGeneralParemeter newParem = new DDGeneralParemeter("ParamName", "CurrentTicketNumber"); company.CompanyName = this.tbxCompanyName.Text; company.LicenseCode = this.tbxLicenseCode.Text; company.SubCompanyNumber = this.tbxSubCompanyNumber.Text; company.SubCompanyName = this.tbxSubCompanyName.Text; company.Address = this.tbxCompanyAdd.Text; company.PhoneNumber = this.tbxCompanyPhone.Text; company.Postalcode = this.tbxPostalCode.Text; company.ShopHours = this.tbxShopHours.Text; company.SetupDate = this.tbxSetupDate.Text; company.StartTicketNumber = this.tbxStartTicketNumber.Text; company.AmountAccuracy = this.cbxAmountAccuracy.SelectedIndex.ToString(); newParem.ParamValue = this.tbxTicketNumber.Text; company.CountDayMode = this.cbxCountDayMode.SelectedIndex; MainForm.AmountAccuracy = this.cbxAmountAccuracy.SelectedIndex; MainForm.CountDayMode = this.cbxCountDayMode.SelectedIndex; company.Save(); newParem.Save(); MessageBox.Show("典当行信息更新成功!"); }
public bool Destroy(object CompanyID) { return(DDCompanyInfo.Destroy(CompanyID) == 1); }
public bool Delete(object CompanyID) { return(DDCompanyInfo.Delete(CompanyID) == 1); }
private void LoadTemplate(RenewPawnOperationForm frmRenewPawnOperation, int iTicketID) { MSExcel.Application excelApp; //Excel应用程序变量 MSExcel.Workbook excelDoc; //Excel文档变量 excelApp = new MSExcel.ApplicationClass(); //初始化 //由于使用的是COM库,因此有许多变量需要用Nothing代替 Object Nothing = Missing.Value; excelDoc = excelApp.Workbooks._Open(Application.StartupPath + @"\Pram\RenewTemplate.dd", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); //使用第一个工作表作为插入数据的工作表 MSExcel.Worksheet ws = (MSExcel.Worksheet)excelDoc.Sheets[1]; //声明一个MSExcel.Range 类型的变量r MSExcel.Range r; DDCompanyInfo company = new DDCompanyInfo("CompanyID", 1); //this.lblCompanyName.Text = company.CompanyName; //this.lblOldTicketNumber.Text = frmRenewPawnOperation.lblOldTicketNum.Text; r = ws.get_Range(("F" + 4), ("F" + 4)); r.Value2 = company.CompanyName; r = ws.get_Range(("M" + 4), ("M" + 4)); r.Value2 = frmRenewPawnOperation.lblOldTicketNum.Text; m_TicketID = iTicketID; DDPawnTicket newTicket = new DDPawnTicket("TicketID", iTicketID); DDCustomerInfo newCustomer = new DDCustomerInfo("CustomerID", newTicket.CustomerID); //this.lblCustomerName.Text = newCustomer.CustomerName; //this.lblContactPerson.Text = newCustomer.ContactPerson; r = ws.get_Range(("F" + 5), ("F" + 5)); r.Value2 = newCustomer.CustomerName; r = ws.get_Range(("M" + 5), ("M" + 5)); r.Value2 = newCustomer.ContactPerson; //this.lblAmount.Text = frmRenewPawnOperation.tbxTotalAmount.Text; //this.lblAmountChinese.Text = newChinese.toChineseChar(Convert.ToDecimal(frmRenewPawnOperation.tbxTotalAmount.Text)); //this.lblServiceFee.Text = frmRenewPawnOperation.tbxServiceFee.Text; //this.lblServiceFeeChinese.Text = newChinese.toChineseChar(Convert.ToDecimal(frmRenewPawnOperation.tbxServiceFee.Text)); //this.lblPaidInterestFee.Text = frmRenewPawnOperation.lblPaidInterest.Text; //this.lblPaidInterestFeeChinese.Text = newChinese.toChineseChar(Convert.ToDecimal(frmRenewPawnOperation.lblPaidInterest.Text)); r = ws.get_Range(("M" + 6), ("M" + 6)); r.Value2 = Convert.ToDouble(frmRenewPawnOperation.tbxTotalAmount.Text).ToString("0.00"); r = ws.get_Range(("H" + 6), ("H" + 6)); r.Value2 = newChinese.toChineseChar(Convert.ToDecimal(frmRenewPawnOperation.tbxTotalAmount.Text)); r = ws.get_Range(("M" + 7), ("M" + 7)); r.Value2 = Convert.ToDouble(frmRenewPawnOperation.tbxServiceFee.Text).ToString("0.00"); r = ws.get_Range(("H" + 7), ("H" + 7)); r.Value2 = newChinese.toChineseChar(Convert.ToDecimal(frmRenewPawnOperation.tbxServiceFee.Text)); r = ws.get_Range(("M" + 8), ("M" + 8)); r.Value2 = Convert.ToDouble(frmRenewPawnOperation.tbxLastInterestFee.Text).ToString("0.00"); r = ws.get_Range(("H" + 8), ("H" + 8)); r.Value2 = newChinese.toChineseChar(Convert.ToDecimal(frmRenewPawnOperation.tbxLastInterestFee.Text)); double totalPaidFee = Convert.ToDouble(frmRenewPawnOperation.tbxServiceFee.Text) + Convert.ToDouble(frmRenewPawnOperation.tbxLastInterestFee.Text); //this.lblPaidFee.Text = totalPaidFee.ToString(); //this.lblPaidFeeChinese.Text = newChinese.toChineseChar(Convert.ToDecimal(totalPaidFee)); r = ws.get_Range(("H" + 9), ("H" + 9)); r.Value2 = newChinese.toChineseChar(Convert.ToDecimal(totalPaidFee)); r = ws.get_Range(("M" + 9), ("M" + 9)); r.Value2 = totalPaidFee.ToString("0.00"); DateTime startDate = Convert.ToDateTime(frmRenewPawnOperation.tbxStartDate.Text); DateTime endDate = Convert.ToDateTime(frmRenewPawnOperation.tbxEndDate.Text); DateTime operationDate = Convert.ToDateTime(frmRenewPawnOperation.tbxOperationDate.Text); //this.lblStartYear.Text = startDate.Year.ToString(); //this.lblStartMonth.Text = startDate.Month.ToString(); //this.lblStartDay.Text = startDate.Day.ToString(); //this.lblEndYear.Text = endDate.Year.ToString(); //this.lblEndMonth.Text = endDate.Month.ToString(); //this.lblEndDay.Text = endDate.Day.ToString(); //this.lblOperationYear.Text = operationDate.Year.ToString(); //this.lblOperationMonth.Text = operationDate.Month.ToString(); //this.lblOperationDay.Text = operationDate.Day.ToString(); r = ws.get_Range(("F" + 10), ("F" + 10)); r.Value2 = startDate.Year.ToString(); r = ws.get_Range(("I" + 10), ("I" + 10)); r.Value2 = startDate.Month.ToString(); r = ws.get_Range(("J" + 10), ("J" + 10)); r.Value2 = startDate.Day.ToString(); r = ws.get_Range(("K" + 10), ("K" + 10)); r.Value2 = endDate.Year.ToString(); r = ws.get_Range(("L" + 10), ("L" + 10)); r.Value2 = endDate.Month.ToString(); r = ws.get_Range(("M" + 10), ("M" + 10)); r.Value2 = endDate.Day.ToString(); r = ws.get_Range(("M" + 13), ("M" + 13)); r.Value2 = operationDate.Year.ToString(); r = ws.get_Range(("O" + 13), ("O" + 13)); r.Value2 = operationDate.Month.ToString(); r = ws.get_Range(("Q" + 13), ("Q" + 13)); r.Value2 = operationDate.Day.ToString(); double serviceFeeRate = Convert.ToDouble(frmRenewPawnOperation.dataGridView1.Rows[0].Cells["FeeRate"].Value); double interestRate = Convert.ToDouble(frmRenewPawnOperation.dataGridView1.Rows[0].Cells["InterestRate"].Value); //this.lblMonthFeeRate.Text = serviceFeeRate.ToString(); //this.lblInterestFeeRate.Text = interestRate.ToString(); //this.lblOperater.Text = MainForm.AccountName; r = ws.get_Range(("D" + 11), ("D" + 11)); r.Value2 = serviceFeeRate.ToString(); r = ws.get_Range(("D" + 12), ("D" + 12)); r.Value2 = interestRate.ToString(); DDUser newUser = new DDUser("AccountName", MainForm.AccountName); r = ws.get_Range(("I" + 13), ("I" + 13)); r.Value2 = newUser.UserName; //WdSaveFormat为Excel文档的保存格式 object format = MSExcel.XlFileFormat.xlWorkbookNormal; //将excelDoc文档对象的内容保存为dd文档 //excelDoc.Save(); //excelDoc.SaveAs(path, format, Nothing, Nothing, Nothing, Nothing, MSExcel.ddaveAsAccessMode.xlExclusive, Nothing, Nothing, Nothing, Nothing, Nothing); excelDoc.PrintOut(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing); if (File.Exists(Application.StartupPath + @"\Pram\dump.dd")) { try { File.Delete(Application.StartupPath + @"\Pram\dump.dd"); } catch (FieldAccessException e) { MessageBox.Show("记录文件正在被使用,请退出Excel\n" + e.ToString()); } } excelDoc.SaveAs(Application.StartupPath + @"\Pram\dump.dd", format, Nothing, Nothing, Nothing, Nothing, MSExcel.XlSaveAsAccessMode.xlExclusive, Nothing, Nothing, Nothing, Nothing, Nothing); //关闭excelDoc文档对象 excelDoc.Close(Nothing, Nothing, Nothing); //关闭excelApp组件对象 excelApp.Quit(); //MessageBox.Show("生成成功"); //PrintReceipt(); }
private void LoadTemplate(int iTicketID, string strOperationNumber) { double TotalAmount = 0; double TotalServiceFee = 0; double TotalLastInterestFee = 0; DDPawnTicket newTicket = new DDPawnTicket("TicketID", m_TicketID); Query queryOperation = new Query(DDOperation.Schema); queryOperation.AddWhere("TicketID", m_TicketID); queryOperation.AddWhere("OperationNumber", strOperationNumber); queryOperation.AddWhere("OperationType", Comparison.NotEquals, 6); DataTable dtOperation = queryOperation.ExecuteDataSet().Tables[0]; for (int i = 0; i < dtOperation.Rows.Count; i++) { TotalAmount += Convert.ToDouble(dtOperation.Rows[i]["Amount"].ToString()); TotalServiceFee += Convert.ToDouble(dtOperation.Rows[i]["ServiceFee"].ToString()); TotalLastInterestFee += Convert.ToDouble(dtOperation.Rows[i]["InterestFee"].ToString()); } TotalAmount = DianDangFunction.myRound(TotalAmount, MainForm.AmountAccuracy); TotalServiceFee = DianDangFunction.myRound(TotalServiceFee, MainForm.AmountAccuracy); TotalLastInterestFee = DianDangFunction.myRound(TotalLastInterestFee, MainForm.AmountAccuracy); MSExcel.Application excelApp; //Excel应用程序变量 MSExcel.Workbook excelDoc; //Excel文档变量 excelApp = new MSExcel.ApplicationClass(); //初始化 //由于使用的是COM库,因此有许多变量需要用Nothing代替 Object Nothing = Missing.Value; excelDoc = excelApp.Workbooks._Open(Application.StartupPath + @"\Pram\RenewTemplate.dd", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); //使用第一个工作表作为插入数据的工作表 MSExcel.Worksheet ws = (MSExcel.Worksheet)excelDoc.Sheets[1]; //声明一个MSExcel.Range 类型的变量r MSExcel.Range r; DDCompanyInfo company = new DDCompanyInfo("CompanyID", 1); //this.lblCompanyName.Text = company.CompanyName; //this.lblOldTicketNumber.Text = frmRenewPawnOperation.lblOldTicketNum.Text; r = ws.get_Range(("F" + 4), ("F" + 4)); r.Value2 = company.CompanyName; r = ws.get_Range(("M" + 4), ("M" + 4)); r.Value2 = newTicket.TicketNumber.ToString(); ; DDCustomerInfo newCustomer = new DDCustomerInfo("CustomerID", newTicket.CustomerID); //this.lblCustomerName.Text = newCustomer.CustomerName; //this.lblContactPerson.Text = newCustomer.ContactPerson; r = ws.get_Range(("F" + 5), ("F" + 5)); r.Value2 = newCustomer.CustomerName; r = ws.get_Range(("M" + 5), ("M" + 5)); r.Value2 = newCustomer.ContactPerson; //this.lblAmount.Text = frmRenewPawnOperation.tbxTotalAmount.Text; //this.lblAmountChinese.Text = newChinese.toChineseChar(Convert.ToDecimal(frmRenewPawnOperation.tbxTotalAmount.Text)); //this.lblServiceFee.Text = frmRenewPawnOperation.tbxServiceFee.Text; //this.lblServiceFeeChinese.Text = newChinese.toChineseChar(Convert.ToDecimal(frmRenewPawnOperation.tbxServiceFee.Text)); //this.lblPaidInterestFee.Text = frmRenewPawnOperation.lblPaidInterest.Text; //this.lblPaidInterestFeeChinese.Text = newChinese.toChineseChar(Convert.ToDecimal(frmRenewPawnOperation.lblPaidInterest.Text)); r = ws.get_Range(("M" + 6), ("M" + 6)); r.Value2 = TotalAmount.ToString("0.00"); r = ws.get_Range(("H" + 6), ("H" + 6)); r.Value2 = newChinese.toChineseChar(Convert.ToDecimal(TotalAmount)); r = ws.get_Range(("M" + 7), ("M" + 7)); r.Value2 = TotalServiceFee.ToString("0.00"); r = ws.get_Range(("H" + 7), ("H" + 7)); r.Value2 = newChinese.toChineseChar(Convert.ToDecimal(TotalServiceFee)); r = ws.get_Range(("M" + 8), ("M" + 8)); r.Value2 = TotalLastInterestFee.ToString("0.00"); r = ws.get_Range(("H" + 8), ("H" + 8)); r.Value2 = newChinese.toChineseChar(Convert.ToDecimal(TotalLastInterestFee)); double totalPaidFee = TotalServiceFee + TotalLastInterestFee; //this.lblPaidFee.Text = totalPaidFee.ToString(); //this.lblPaidFeeChinese.Text = newChinese.toChineseChar(Convert.ToDecimal(totalPaidFee)); r = ws.get_Range(("H" + 9), ("H" + 9)); r.Value2 = newChinese.toChineseChar(Convert.ToDecimal(totalPaidFee)); r = ws.get_Range(("M" + 9), ("M" + 9)); r.Value2 = totalPaidFee.ToString("0.00"); DateTime startDate = Convert.ToDateTime(dtOperation.Rows[0]["StartDate"].ToString()); DateTime endDate = Convert.ToDateTime(dtOperation.Rows[0]["EndDate"].ToString()); DateTime operationDate = Convert.ToDateTime(dtOperation.Rows[0]["OperationDate"].ToString()); //this.lblStartYear.Text = startDate.Year.ToString(); //this.lblStartMonth.Text = startDate.Month.ToString(); //this.lblStartDay.Text = startDate.Day.ToString(); //this.lblEndYear.Text = endDate.Year.ToString(); //this.lblEndMonth.Text = endDate.Month.ToString(); //this.lblEndDay.Text = endDate.Day.ToString(); //this.lblOperationYear.Text = operationDate.Year.ToString(); //this.lblOperationMonth.Text = operationDate.Month.ToString(); //this.lblOperationDay.Text = operationDate.Day.ToString(); r = ws.get_Range(("F" + 10), ("F" + 10)); r.Value2 = startDate.Year.ToString(); r = ws.get_Range(("I" + 10), ("I" + 10)); r.Value2 = startDate.Month.ToString(); r = ws.get_Range(("J" + 10), ("J" + 10)); r.Value2 = startDate.Day.ToString(); r = ws.get_Range(("K" + 10), ("K" + 10)); r.Value2 = endDate.Year.ToString(); r = ws.get_Range(("L" + 10), ("L" + 10)); r.Value2 = endDate.Month.ToString(); r = ws.get_Range(("M" + 10), ("M" + 10)); r.Value2 = endDate.Day.ToString(); r = ws.get_Range(("M" + 13), ("M" + 13)); r.Value2 = operationDate.Year.ToString(); r = ws.get_Range(("O" + 13), ("O" + 13)); r.Value2 = operationDate.Month.ToString(); r = ws.get_Range(("Q" + 13), ("Q" + 13)); r.Value2 = operationDate.Day.ToString(); double serviceFeeRate = Convert.ToDouble(dtOperation.Rows[0]["ServiceFeeRate"].ToString()); double interestRate = Convert.ToDouble(dtOperation.Rows[0]["InterestFeeRate"].ToString()); //this.lblMonthFeeRate.Text = serviceFeeRate.ToString(); //this.lblInterestFeeRate.Text = interestRate.ToString(); //this.lblOperater.Text = MainForm.AccountName; r = ws.get_Range(("D" + 11), ("D" + 11)); r.Value2 = serviceFeeRate.ToString(); r = ws.get_Range(("D" + 12), ("D" + 12)); r.Value2 = interestRate.ToString(); DDUser newUser = new DDUser("AccountName", MainForm.AccountName); r = ws.get_Range(("I" + 13), ("I" + 13)); r.Value2 = newUser.UserName; //WdSaveFormat为Excel文档的保存格式 object format = MSExcel.XlFileFormat.xlWorkbookNormal; //将excelDoc文档对象的内容保存为dd文档 //excelDoc.Save(); //excelDoc.SaveAs(path, format, Nothing, Nothing, Nothing, Nothing, MSExcel.ddaveAsAccessMode.xlExclusive, Nothing, Nothing, Nothing, Nothing, Nothing); excelDoc.PrintOut(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing); if (File.Exists(Application.StartupPath + @"\Pram\dump.dd")) { try { File.Delete(Application.StartupPath + @"\Pram\dump.dd"); } catch (FieldAccessException e) { MessageBox.Show("记录文件正在被使用,请退出Excel\n" + e.ToString()); } } excelDoc.SaveAs(Application.StartupPath + @"\Pram\dump.dd", format, Nothing, Nothing, Nothing, Nothing, MSExcel.XlSaveAsAccessMode.xlExclusive, Nothing, Nothing, Nothing, Nothing, Nothing); //关闭excelDoc文档对象 excelDoc.Close(Nothing, Nothing, Nothing); //关闭excelApp组件对象 excelApp.Quit(); //MessageBox.Show("生成成功"); //PrintReceipt(); }
private void LoadTemplate(int iTicketID, string strOperationNumber) { double TotalAmount = 0; double TotalServiceFee = 0; double TotalLastInterestFee = 0; double TotalReturnFee = 0; double TotalOverdueFee = 0; double FirstTotalServiceFee = 0; double FirstTotalAmount = 0; List <string> strList = new List <string>(); DDPawnTicket newTicket = new DDPawnTicket("TicketID", m_TicketID); DDCustomerInfo newCustomer = new DDCustomerInfo("CustomerID", newTicket.CustomerID); Query queryOperation = new Query(DDOperation.Schema); queryOperation.AddWhere("TicketID", m_TicketID); queryOperation.AddWhere("OperationNumber", strOperationNumber); queryOperation.AddWhere("OperationType", Comparison.NotEquals, 6); DataTable dtOperation = queryOperation.ExecuteDataSet().Tables[0]; for (int i = 0; i < dtOperation.Rows.Count; i++) { TotalAmount += Convert.ToDouble(dtOperation.Rows[i]["Amount"].ToString()); TotalServiceFee += Convert.ToDouble(dtOperation.Rows[i]["ServiceFee"].ToString()); TotalLastInterestFee += Convert.ToDouble(dtOperation.Rows[i]["InterestFee"].ToString()); TotalReturnFee += Convert.ToDouble(dtOperation.Rows[i]["ReturnFee"].ToString()); TotalOverdueFee += Convert.ToDouble(dtOperation.Rows[i]["OverdueFee"].ToString()); } TotalAmount = DianDangFunction.myRound(TotalAmount, MainForm.AmountAccuracy); TotalServiceFee = DianDangFunction.myRound(TotalServiceFee, MainForm.AmountAccuracy); TotalLastInterestFee = DianDangFunction.myRound(TotalLastInterestFee, MainForm.AmountAccuracy); TotalReturnFee = DianDangFunction.myRound(TotalReturnFee, MainForm.AmountAccuracy); TotalOverdueFee = DianDangFunction.myRound(TotalOverdueFee, MainForm.AmountAccuracy); queryOperation = new Query(DDOperation.Schema); queryOperation.AddWhere("TicketID", m_TicketID); queryOperation.AddWhere("PreOperationID", 0); queryOperation.AddWhere("OperationType", Comparison.NotEquals, 6); dtOperation = queryOperation.ExecuteDataSet().Tables[0]; for (int i = 0; i < dtOperation.Rows.Count; i++) { FirstTotalAmount += Convert.ToDouble(dtOperation.Rows[i]["Amount"].ToString()); FirstTotalServiceFee += Convert.ToDouble(dtOperation.Rows[i]["ServiceFee"].ToString()); } FirstTotalAmount = DianDangFunction.myRound(FirstTotalAmount, MainForm.AmountAccuracy); FirstTotalServiceFee = DianDangFunction.myRound(FirstTotalServiceFee, MainForm.AmountAccuracy); MSExcel.Application excelApp; //Excel应用程序变量 MSExcel.Workbook excelDoc; //Excel文档变量 excelApp = new MSExcel.ApplicationClass(); //初始化 //由于使用的是COM库,因此有许多变量需要用Nothing代替 Object Nothing = Missing.Value; excelDoc = excelApp.Workbooks._Open(Application.StartupPath + @"\Pram\RedeemTemplate_TongBao.dd", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); //使用第一个工作表作为插入数据的工作表 MSExcel.Worksheet ws = (MSExcel.Worksheet)excelDoc.Sheets[1]; //声明一个MSExcel.Range 类型的变量r MSExcel.Range r; DDCompanyInfo company = new DDCompanyInfo("CompanyID", 1); //r = ws.get_Range(("F" + 4), ("F" + 4)); r.Value2 = company.CompanyName; r = ws.get_Range(("K" + 5), ("K" + 5)); r.Value2 = newTicket.TicketNumber.ToString(); r = ws.get_Range(("D" + 5), ("D" + 5)); r.Value2 = newCustomer.CustomerName; //TotalAmount: string strTotalMount = TotalAmount.ToString("0.00"); r = ws.get_Range(("D" + 7), ("D" + 7)); r.Value2 = newChinese.toChineseChar(strTotalMount); r = ws.get_Range(("M" + 7), ("M" + 7)); r.Value2 = strTotalMount; //Fee string strFirstGive = (FirstTotalAmount - FirstTotalServiceFee).ToString("0.00"); r = ws.get_Range(("E" + 13), ("E" + 13)); r.Value2 = newChinese.toChineseChar(strFirstGive); r = ws.get_Range(("L" + 13), ("L" + 13)); r.Value2 = strFirstGive; string strFirstServiceFee = FirstTotalServiceFee.ToString("0.00"); r = ws.get_Range(("E" + 15), ("E" + 15)); r.Value2 = newChinese.toChineseChar(strFirstServiceFee); r = ws.get_Range(("L" + 15), ("L" + 15)); r.Value2 = strFirstServiceFee; string strOverdue = (Math.Abs(TotalLastInterestFee + TotalOverdueFee - TotalReturnFee + TotalServiceFee)).ToString("0.00"); r = ws.get_Range(("E" + 17), ("E" + 17)); r.Value2 = newChinese.toChineseChar(strOverdue); r = ws.get_Range(("L" + 17), ("L" + 17)); r.Value2 = strOverdue; string strAll = (TotalAmount + TotalLastInterestFee + TotalOverdueFee + TotalServiceFee - TotalReturnFee).ToString("0.00"); strList = newChinese.toStrList(strAll, 5, 2); r = ws.get_Range(("D" + 19), ("D" + 19)); r.Value2 = strList[0]; r = ws.get_Range(("E" + 19), ("E" + 19)); r.Value2 = strList[1]; r = ws.get_Range(("G" + 19), ("G" + 19)); r.Value2 = strList[2]; r = ws.get_Range(("H" + 19), ("H" + 19)); r.Value2 = strList[3]; r = ws.get_Range(("I" + 19), ("I" + 19)); r.Value2 = strList[4]; r = ws.get_Range(("J" + 19), ("J" + 19)); r.Value2 = strList[5]; r = ws.get_Range(("L" + 19), ("L" + 19)); r.Value2 = strList[6]; r = ws.get_Range(("N" + 19), ("N" + 19)); r.Value2 = strAll; //日期 DDOperation ThisOperation = new DDOperation("OperationNumber", strOperationNumber); DDOperation LastOperation = new DDOperation("OperationID", ThisOperation.PreOperationID); DateTime operationDate = Convert.ToDateTime(ThisOperation.OperationDate); DateTime lastStartDate = Convert.ToDateTime(LastOperation.StartDate); DateTime lastEndDate = Convert.ToDateTime(LastOperation.EndDate); r = ws.get_Range(("C" + 9), ("C" + 9)); r.Value2 = lastStartDate.Year.ToString(); r = ws.get_Range(("E" + 9), ("E" + 9)); r.Value2 = lastStartDate.Month.ToString(); r = ws.get_Range(("G" + 9), ("G" + 9)); r.Value2 = lastStartDate.Day.ToString(); r = ws.get_Range(("I" + 9), ("I" + 9)); r.Value2 = lastEndDate.Year.ToString(); r = ws.get_Range(("J" + 9), ("J" + 9)); r.Value2 = lastEndDate.Month.ToString(); r = ws.get_Range(("L" + 9), ("L" + 9)); r.Value2 = lastEndDate.Day.ToString(); r = ws.get_Range(("B" + 11), ("B" + 11)); r.Value2 = operationDate.Year.ToString(); r = ws.get_Range(("D" + 11), ("D" + 11)); r.Value2 = operationDate.Month.ToString(); r = ws.get_Range(("G" + 11), ("G" + 11)); r.Value2 = operationDate.Day.ToString(); r = ws.get_Range(("L" + 3), ("L" + 3)); r.Value2 = operationDate.Year.ToString(); r = ws.get_Range(("N" + 3), ("N" + 3)); r.Value2 = operationDate.Month.ToString(); r = ws.get_Range(("O" + 3), ("O" + 3)); r.Value2 = operationDate.Day.ToString(); //double serviceFeeRate = Convert.ToDouble(dtOperation.Rows[0]["ServiceFeeRate"].ToString()); //double interestRate = Convert.ToDouble(dtOperation.Rows[0]["InterestFeeRate"].ToString()); //r = ws.get_Range(("D" + 11), ("D" + 11)); r.Value2 = serviceFeeRate.ToString(); //r = ws.get_Range(("D" + 12), ("D" + 12)); r.Value2 = interestRate.ToString(); DDUser newUser = new DDUser("AccountName", MainForm.AccountName); r = ws.get_Range(("K" + 21), ("K" + 21)); r.Value2 = newUser.UserName; //WdSaveFormat为Excel文档的保存格式 object format = MSExcel.XlFileFormat.xlWorkbookNormal; //将excelDoc文档对象的内容保存为dd文档 //excelDoc.Save(); //excelDoc.SaveAs(path, format, Nothing, Nothing, Nothing, Nothing, MSExcel.ddaveAsAccessMode.xlExclusive, Nothing, Nothing, Nothing, Nothing, Nothing); excelDoc.PrintOut(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing); if (File.Exists(Application.StartupPath + @"\Pram\dump.dd")) { try { File.Delete(Application.StartupPath + @"\Pram\dump.dd"); } catch (FieldAccessException e) { MessageBox.Show("记录文件正在被使用,请退出Excel\n" + e.ToString()); } } excelDoc.SaveAs(Application.StartupPath + @"\Pram\dump.dd", format, Nothing, Nothing, Nothing, Nothing, MSExcel.XlSaveAsAccessMode.xlExclusive, Nothing, Nothing, Nothing, Nothing, Nothing); //关闭excelDoc文档对象 excelDoc.Close(Nothing, Nothing, Nothing); //关闭excelApp组件对象 excelApp.Quit(); //MessageBox.Show("生成成功"); //PrintReceipt(); }
private void OperationAmount() { DateTime startDate = Convert.ToDateTime(this.tbxStartDate.Text.Trim()); DateTime endDate = Convert.ToDateTime(this.tbxEndDate.Text.Trim()); double newPawnAmount = 0; double closeOfNewAmount = 0; double redeemPawnAmount = 0; double renewPawnAmount = 0; double closePawnAmount = 0; double goldOfClosePawnAmount = 0; double clearPawnAmount = 0; double clearPawnReckonAmount = 0; double reckoningPL = 0; //清算盈亏 double unclearPawnAmount = 0; double newPawnServiceFee = 0; //建当服务费 double renewPawnServiceFee = 0; //续当服务费 double interestFee = 0; //典当利息 double overDueFee = 0; //逾期服务费 double returnFee = 0; //返回服务费 double totalFee = 0; //总计营收 int operationType = 0; double amount = 0; Query queryOperations = new Query(DDOperation.Schema); queryOperations.AddBetweenAnd("OperationDate", startDate, endDate); DataTable dtOperations = queryOperations.ExecuteDataSet().Tables[0]; if (dtOperations.Rows.Count > 0) { for (int i = 0; i < dtOperations.Rows.Count; i++) { operationType = Convert.ToInt32(dtOperations.Rows[i]["OperationType"]); amount = Convert.ToDouble(dtOperations.Rows[i]["Amount"]); switch (operationType) { case 1: newPawnAmount += amount; DDPawnTicket newTicket = new DDPawnTicket("TicketID", Convert.ToInt32(dtOperations.Rows[i]["TicketID"])); if (newTicket.StatusID == 4 || newTicket.StatusID == 7) { closeOfNewAmount += amount; } newPawnServiceFee += Convert.ToDouble(dtOperations.Rows[i]["ServiceFee"]); interestFee += Convert.ToDouble(dtOperations.Rows[i]["InterestFee"]); break; case 2: redeemPawnAmount += amount; overDueFee += Convert.ToDouble(dtOperations.Rows[i]["OverdueFee"]); returnFee += Convert.ToDouble(dtOperations.Rows[i]["ReturnFee"]); interestFee += Convert.ToDouble(dtOperations.Rows[i]["InterestFee"]); break; case 3: renewPawnAmount += amount; renewPawnServiceFee += Convert.ToDouble(dtOperations.Rows[i]["ServiceFee"]); interestFee += Convert.ToDouble(dtOperations.Rows[i]["InterestFee"]); break; case 4: closePawnAmount += amount; DDPawnageInfo newPawnage = new DDPawnageInfo("PawnageID", Convert.ToInt32(dtOperations.Rows[i]["PawnageID"])); if (newPawnage.ParentID == 2) //2:黄金类ClassID { goldOfClosePawnAmount += amount; } break; case 7: clearPawnAmount += amount; clearPawnReckonAmount += Convert.ToDouble(dtOperations.Rows[i]["ReckonAmount"]); break; default: break; } } reckoningPL = clearPawnReckonAmount - clearPawnAmount; //清算盈亏 unclearPawnAmount = closePawnAmount - clearPawnAmount; //未清算金额 totalFee = newPawnServiceFee + renewPawnServiceFee + interestFee + overDueFee - returnFee; } double allNewPawnAmount = 0; //double closeOfAllNewPawnAmount = 0; double allRedeemPawnAmount = 0; double allClosePawnAmount = 0; DDCompanyInfo company = new DDCompanyInfo("CompanyID", 1); DateTime setupDate = Convert.ToDateTime(company.SetupDate); Query queryAllOperations = new Query(DDOperation.Schema); queryAllOperations.AddBetweenAnd("OperationDate", setupDate, endDate); //所有的操作记录 DataTable dtAllOperations = queryAllOperations.ExecuteDataSet().Tables[0]; if (dtAllOperations.Rows.Count > 0) { for (int j = 0; j < dtAllOperations.Rows.Count; j++) { operationType = Convert.ToInt32(dtAllOperations.Rows[j]["OperationType"]); amount = Convert.ToDouble(dtAllOperations.Rows[j]["Amount"]); if (operationType == 1) { allNewPawnAmount += amount; //DDPawnTicket newTicket = new DDPawnTicket("TicketID", Convert.ToInt32(dtAllOperations.Rows[j]["TicketID"])); //if (newTicket.StatusID == 4 || newTicket.StatusID == 7) //{ // closeOfAllNewPawnAmount += amount; //} } if (operationType == 2) { allRedeemPawnAmount += amount; } if (operationType == 4) { allClosePawnAmount += amount; } } } double startTotalAmount = 0; double endTotalAmount = 0; double increAmount = 0; double totalAmount = 0; endTotalAmount = allNewPawnAmount - allClosePawnAmount - allRedeemPawnAmount; increAmount = newPawnAmount - closePawnAmount - redeemPawnAmount; startTotalAmount = endTotalAmount - increAmount; totalAmount = endTotalAmount + unclearPawnAmount; double percentCloseOfNewPawn = 0; double percentIncreOfStart = 0; double percentIncreOfEnd = 0; double percentNewPawnServiceFeeOfTotal = 0; double percentRenewPawnServiceFeeOfTotal = 0; double percentInterestFeeOfTotal = 0; double percentRetureFeeOfTotal = 0; double percentOverdueFeeOfTotal = 0; if (newPawnAmount != 0) { percentCloseOfNewPawn = closeOfNewAmount * 100 / newPawnAmount; percentCloseOfNewPawn = DianDangFunction.myRound(percentCloseOfNewPawn, MainForm.AmountAccuracy); } if (startTotalAmount != 0) { percentIncreOfStart = increAmount * 100 / startTotalAmount; percentIncreOfStart = DianDangFunction.myRound(percentIncreOfStart, MainForm.AmountAccuracy); } if (endTotalAmount != 0) { percentIncreOfEnd = increAmount * 100 / endTotalAmount; percentIncreOfEnd = DianDangFunction.myRound(percentIncreOfEnd, MainForm.AmountAccuracy); } if (totalFee != 0) { percentNewPawnServiceFeeOfTotal = newPawnServiceFee * 100 / totalFee; percentNewPawnServiceFeeOfTotal = DianDangFunction.myRound(percentNewPawnServiceFeeOfTotal, MainForm.AmountAccuracy); percentRenewPawnServiceFeeOfTotal = renewPawnServiceFee * 100 / totalFee; percentRenewPawnServiceFeeOfTotal = DianDangFunction.myRound(percentRenewPawnServiceFeeOfTotal, MainForm.AmountAccuracy); percentInterestFeeOfTotal = interestFee * 100 / totalFee; percentInterestFeeOfTotal = DianDangFunction.myRound(percentInterestFeeOfTotal, MainForm.AmountAccuracy); percentRetureFeeOfTotal = returnFee * 100 / totalFee; percentRetureFeeOfTotal = DianDangFunction.myRound(percentRetureFeeOfTotal, MainForm.AmountAccuracy); percentOverdueFeeOfTotal = overDueFee * 100 / totalFee; percentOverdueFeeOfTotal = DianDangFunction.myRound(percentOverdueFeeOfTotal, MainForm.AmountAccuracy); } this.lblNewPawnAmount.Text = newPawnAmount.ToString(); this.lblCloseOfNewAmount.Text = closeOfNewAmount.ToString(); this.lblRenewPawnAmount.Text = renewPawnAmount.ToString(); this.lblSalesSize.Text = (newPawnAmount + renewPawnAmount).ToString(); this.lblRedeemPawnAmount.Text = redeemPawnAmount.ToString(); this.lblClosePawnAmount.Text = closePawnAmount.ToString(); this.lblGoldOfCloseAmount.Text = goldOfClosePawnAmount.ToString(); this.lblStartTotalAmount.Text = startTotalAmount.ToString(); this.lblEndTotalAmount.Text = endTotalAmount.ToString(); this.lblIncreAmount.Text = increAmount.ToString(); this.lblTotalFee.Text = totalFee.ToString(); newPawnServiceFee = DianDangFunction.myRound(newPawnServiceFee, MainForm.AmountAccuracy); this.lblNewPawnServiceFee.Text = newPawnServiceFee.ToString(); this.lblRenewPawnServiceFee.Text = renewPawnServiceFee.ToString(); this.lblInterestFee.Text = interestFee.ToString(); this.lblOverDueFee.Text = overDueFee.ToString(); this.lblReturnFee.Text = returnFee.ToString(); this.lblCloseClearAmount.Text = clearPawnAmount.ToString(); //绝当处理金额 this.lblClearAmount.Text = clearPawnReckonAmount.ToString(); //清算金额 this.lblReckoningPL.Text = reckoningPL.ToString(); this.lblUnclearAmount.Text = unclearPawnAmount.ToString(); this.lblTotalAmount.Text = totalAmount.ToString(); //总收入 this.lblTotalIncommingAmount.Text = (totalFee + redeemPawnAmount).ToString(); //总支出 this.lblTotalOutAmount.Text = newPawnAmount.ToString(); //收支余额 this.lblTotalBalance.Text = (totalFee + redeemPawnAmount - newPawnAmount).ToString("0.00"); this.lblCloseOfNewPercent.Text = percentCloseOfNewPawn.ToString(); this.lblIncreOfStartPercent.Text = percentIncreOfStart.ToString(); this.lblIncreOfEndPercent.Text = percentIncreOfEnd.ToString(); this.lblNewServiceFeeOfTotal.Text = percentNewPawnServiceFeeOfTotal.ToString(); this.lblRenewServiceFeeOfTotal.Text = percentRenewPawnServiceFeeOfTotal.ToString(); this.lblInterestFeeOfTotal.Text = percentInterestFeeOfTotal.ToString(); this.lblReturnfeeOfTotal.Text = percentRetureFeeOfTotal.ToString(); this.lblOverdueFeeOfTotal.Text = percentOverdueFeeOfTotal.ToString(); }
private void OperationCount() { try { DateTime startDate = Convert.ToDateTime(this.tbxStartDate.Text.Trim()); DateTime endDate = Convert.ToDateTime(this.tbxEndDate.Text.Trim()); int newPawnCount = 0; int closeOfNewCount = 0; int redeemPawnCount = 0; int renewPawnCount = 0; int closePawnCount = 0; int goldOfClosePawnCount = 0; int operationType = 0; string selectList = string.Format("{0},{1},{2},{3},{4}", DDOperation.OperationNumberColumn.ColumnName, DDOperation.OperationTypeColumn.ColumnName, DDOperation.PawnageIDColumn.ColumnName, DDOperation.TicketIDColumn.ColumnName, DDOperation.OperationDateColumn.ColumnName); Query queryOperations = new Query(DDOperation.Schema).SetSelectList(selectList).AddBetweenAnd("OperationDate", startDate, endDate).ORDER_BY(DDOperation.OperationNumberColumn.ColumnName); DataTable dtOperations = queryOperations.ExecuteDataSet().Tables[0]; if (dtOperations.Rows.Count > 0) { string operationNumber = "0"; string preOperationNumber = "0"; for (int i = 0; i < dtOperations.Rows.Count; i++) { operationNumber = dtOperations.Rows[i]["OperationNumber"].ToString(); if (operationNumber != preOperationNumber) { operationType = Convert.ToInt32(dtOperations.Rows[i]["OperationType"]); switch (operationType) { case 1: newPawnCount++; DDPawnTicket newTicket = new DDPawnTicket("TicketID", Convert.ToInt32(dtOperations.Rows[i]["TicketID"])); if (newTicket.StatusID == 4 || newTicket.StatusID == 7) { closeOfNewCount++; } break; case 2: redeemPawnCount++; break; case 3: renewPawnCount++; break; case 4: closePawnCount++; DDPawnageInfo newPawnage = new DDPawnageInfo("PawnageID", Convert.ToInt32(dtOperations.Rows[i]["PawnageID"])); if (newPawnage.ParentID == 2) //109:黄金类ClassID { goldOfClosePawnCount++; } break; default: break; } preOperationNumber = operationNumber; } } } double allNewPawnCount = 0; //double closeOfAllNewPawnCount = 0; double allRedeemPawnCount = 0; double allClosePawnCount = 0; DDCompanyInfo company = new DDCompanyInfo("CompanyID", 1); DateTime setupDate = Convert.ToDateTime(company.SetupDate); Query queryAllOperations = new Query(DDOperation.Schema).SetSelectList(selectList).DISTINCT().ORDER_BY(DDOperation.OperationNumberColumn.ColumnName); queryAllOperations.AddBetweenAnd("OperationDate", setupDate, endDate); //所有的操作记录 DataTable dtAllOperations = queryAllOperations.ExecuteDataSet().Tables[0]; if (dtAllOperations.Rows.Count > 0) { string operationNumber = "0"; string preOperationNumber = "0"; for (int j = 0; j < dtAllOperations.Rows.Count; j++) { operationNumber = dtAllOperations.Rows[j]["OperationNumber"].ToString(); if (operationNumber != preOperationNumber) { operationType = Convert.ToInt32(dtAllOperations.Rows[j]["OperationType"]); if (operationType == 1) { allNewPawnCount++; // DDPawnTicket newTicket = new DDPawnTicket("TicketID", Convert.ToInt32(dtAllOperations.Rows[j]["TicketID"])); // if (newTicket.StatusID == 4 || newTicket.StatusID == 7) // { // closeOfAllNewPawnCount++; // } } if (operationType == 2) { allRedeemPawnCount++; } if (operationType == 4) { allClosePawnCount++; } preOperationNumber = operationNumber; } } } double startTotalCount = 0; double endTotalCount = 0; double increCount = 0; endTotalCount = allNewPawnCount - allRedeemPawnCount - allClosePawnCount; increCount = newPawnCount - redeemPawnCount - closePawnCount; startTotalCount = endTotalCount - increCount; this.lblNewPawnCount.Text = newPawnCount.ToString(); this.lblCloseOfNewCount.Text = closeOfNewCount.ToString(); this.lblRenewPawnCount.Text = renewPawnCount.ToString(); this.lblSalesCount.Text = (newPawnCount + renewPawnCount).ToString(); this.lblRedeemPawnCount.Text = redeemPawnCount.ToString(); this.lblClosePawnCount.Text = closePawnCount.ToString(); this.lblGoldOfCloseCount.Text = goldOfClosePawnCount.ToString(); this.lblStartTotalCount.Text = startTotalCount.ToString(); this.lblEndTotalCount.Text = endTotalCount.ToString(); this.lblIncreCount.Text = increCount.ToString(); } catch (Exception ex) { throw ex; } }