private List <MainContract> Load_Contact(string filename) { List <MainContract> result = new List <MainContract>(); SqlConnection con = DB2 <SqlConnection> .GetConnection(Config["Connection"]["Conn"].Value);// Get_Connection(); string sql = Config["Sql"]["Load_Contract"].Value; if (con != null) { try { using (SqlDataReader sr = DB_BLL.SQLHelp.ExecuteReader(con, CommandType.Text, sql, null)) { while (sr.Read()) { MainContract s = new MainContract(Convert.ToInt32(sr["CID"]), Convert.ToInt32(sr["area_id"]), sr["area_name"].ToString().Trim(), sr["cust_name"].ToString().Trim(), sr["Address_Comment"].ToString().Trim(), sr["contract_name"].ToString().Trim(), myArray, Config["Connection"]["Conn"].Value); string[] keys = s.SubSys.Keys.ToArray <string>(); foreach (string a in keys) { //此处获取子系统的合同号,用配置文件中的子系统名称-连接到配置数据库中的字段定义,再填到sql中 s.SubSys[a] = sr[Config["Generic"][a].Value].ToString().Trim(); } result.Add(s); } } return(result); } catch (Exception ex) { return(null); } } return(null); }
private List <PdfPCell> GetContantHead(MainContract msc, string AccountDate, int colspan, Font fb) { List <PdfPCell> result = new List <PdfPCell>(); string str1 = @"尊敬的租户:" + msc.Cust_Name + " " + msc.Address_Comment + "\n\n"; PdfPCell head = new PdfPCell(new Phrase(str1, fb)); head.Colspan = colspan; head.Border = Rectangle.NO_BORDER; result.Add(head); string str2 = _options[_profile]["HeadContent1"].Value.ToString();//@"关于东方渔人码头项目租赁单元,双方已签订租赁合同或意向书。"; string str3 = _options[_profile]["HeadContent21"].Value.ToString() + AccountDate.Substring(0, 4) + "年" + AccountDate.Substring(4, 2) + _options[_profile]["HeadContent22"].Value.ToString(); PdfPCell head1 = new PdfPCell(new Phrase(str2 + "\n\n" + str3 + "\n\n", contrant_font)); // PdfPCell result = new PdfPCell(new Phrase(str1, f)); head1.Border = Rectangle.NO_BORDER; head1.Colspan = colspan; result.Add(head1); return(result); }
private List <PdfPCell> GetContantBill(MainContract msc, List <Ticket_Group> Tickets, int colspan, Font fb) { List <PdfPCell> result = new List <PdfPCell>(); double Total_count_zj = 0; double Total_count_else = 0; ///////////////////////////租金类 PdfPCell c_zj = new PdfPCell(new Phrase("租金类账单:", contrant_font)); c_zj.Colspan = colspan; c_zj.Border = Rectangle.NO_BORDER; result.Add(c_zj); foreach (Ticket_Group Ticket in Tickets.FindAll(c => c.Cid == msc.CID)) { if (Ticket.Fee_name.Contains("租金")) { PdfPCell count_time = new PdfPCell(new Phrase(@"结算期:" + Ticket.Data_start + " " + Ticket.Data_end, contrant_font)); count_time.Border = Rectangle.NO_BORDER; result.Add(count_time);//结算期 PdfPCell f_name = new PdfPCell(new Phrase(Ticket.Fee_name, contrant_font)); f_name.Border = Rectangle.NO_BORDER; result.Add(f_name);//费用名称 PdfPCell fee_count = new PdfPCell(new Phrase(@"人民币:" + Ticket.Fee.ToString(), contrant_font)); fee_count.Border = Rectangle.NO_BORDER; result.Add(fee_count);//费用 Total_count_zj += Ticket.Fee; } } PdfPCell c_temp = new PdfPCell();//total左边两格 c_temp.BorderWidth = 0.5f; c_temp.BorderColor = new BaseColor(178, 178, 178); c_temp.Border = Rectangle.NO_BORDER; c_temp.Colspan = colspan - 1; result.Add(c_temp); PdfPCell c_zjtotal = new PdfPCell(new Phrase("合计 :" + Total_count_zj.ToString("f2") + "元\n", contrant_font));//合计 c_zjtotal.BorderWidth = 0.5f; c_zjtotal.BorderColor = new BaseColor(178, 178, 178); c_zjtotal.Border = Rectangle.BOTTOM_BORDER; result.Add(c_zjtotal); PdfPCell c_blank = new PdfPCell(new Phrase(_options[_profile]["kc_bank"].Value.ToString().Replace("\\n", Environment.NewLine), contrant_font)); c_blank.Colspan = colspan; c_blank.BorderWidth = 0.5f; c_blank.BorderColor = new BaseColor(178, 178, 178); c_blank.Border = Rectangle.BOTTOM_BORDER; result.Add(c_blank); ///////////////////////////////物业类 PdfPCell c_wy = new PdfPCell(new Phrase("\n\n物业类账单:", contrant_font)); c_wy.Colspan = colspan; c_wy.Border = Rectangle.NO_BORDER; result.Add(c_wy); foreach (Ticket_Group Ticket in Tickets.FindAll(c => c.Cid == msc.CID)) { if (!Ticket.Fee_name.Contains("租金")) { PdfPCell count_time = new PdfPCell(new Phrase(@"结算期:" + Ticket.Data_start + " " + Ticket.Data_end, contrant_font)); count_time.Border = Rectangle.NO_BORDER; count_time.Border = Rectangle.NO_BORDER; result.Add(count_time); PdfPCell f_name = new PdfPCell(new Phrase(Ticket.Fee_name, contrant_font)); f_name.Border = Rectangle.NO_BORDER; result.Add(f_name);//费用名称 PdfPCell fee_count = new PdfPCell(new Phrase(@"人民币:" + Ticket.Fee.ToString(), contrant_font)); fee_count.Border = Rectangle.NO_BORDER; result.Add(fee_count); Total_count_else += Ticket.Fee; } } result.Add(c_temp); PdfPCell c_wytotal = new PdfPCell(new Phrase("合计 :" + Total_count_else.ToString("f2") + "元\n", contrant_font));//合计 c_wytotal.BorderWidth = 0.5f; c_wytotal.BorderColor = new BaseColor(178, 178, 178); c_wytotal.Border = Rectangle.BOTTOM_BORDER; result.Add(c_wytotal); PdfPCell c_blank1 = new PdfPCell(new Phrase(_options[_profile]["sy_bank"].Value.ToString().Replace("\\n", Environment.NewLine), contrant_font)); c_blank1.Colspan = colspan; c_blank1.BorderWidth = 0.5f; c_blank1.BorderColor = new BaseColor(178, 178, 178); c_blank1.Border = Rectangle.BOTTOM_BORDER; result.Add(c_blank1); return(result); }