179 lines
7.0 KiB
C#
179 lines
7.0 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
using EAS.Services;
|
|||
|
|
using SOH.BLL;
|
|||
|
|
using xiaoy.Excel;
|
|||
|
|
|
|||
|
|
using SOH.Entities;
|
|||
|
|
using SOH.Common;
|
|||
|
|
|
|||
|
|
namespace SOH.SaleSettings
|
|||
|
|
{
|
|||
|
|
public partial class frmTuanJianzhiXingQingKuangChaXun : Form
|
|||
|
|
{
|
|||
|
|
public int htbm;
|
|||
|
|
public frmTuanJianzhiXingQingKuangChaXun()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
}
|
|||
|
|
public frmTuanJianzhiXingQingKuangChaXun(int htbm)
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
this.htbm = htbm;
|
|||
|
|
}
|
|||
|
|
private void frmTuanJianzhiXingQingKuangChaXun_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
var service2 = ServiceContainer.GetService<It_ttgzb>();
|
|||
|
|
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject(service2.GetListtj(htbm), typeof(DataTable)) as DataTable;
|
|||
|
|
dataGridView1.DataSource = dt;
|
|||
|
|
var service = ServiceContainer.GetService<It_ttgzb>();
|
|||
|
|
tttgzbBindingSource.DataSource = service.GetList(htbm, "");
|
|||
|
|
tbrsCount.Text = dgvhtyhList.Rows.Count.ToString();
|
|||
|
|
var service1 = ServiceContainer.GetService<It_ttsfjl>();
|
|||
|
|
tttsfjlBindingSource.DataSource = service1.GetList(htbm);
|
|||
|
|
BindLeabel();
|
|||
|
|
}
|
|||
|
|
public void BindLeabel()
|
|||
|
|
{
|
|||
|
|
double fzhj = 0;//分组合计
|
|||
|
|
double hkhj = 0;//回款合计
|
|||
|
|
double yshj = 0;//应收合计
|
|||
|
|
int htpjzlzs = 0; //合同平均折率总数
|
|||
|
|
double yjzjhj = 0;//原价总价合计
|
|||
|
|
List<t_ttsfjl> al = dataGridView3.DataSource as List<t_ttsfjl>;
|
|||
|
|
DataTable dt = dataGridView1.DataSource as DataTable;
|
|||
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|||
|
|
{
|
|||
|
|
fzhj += Convert.ToDouble(dt.Rows[i]["实检金额"]);
|
|||
|
|
yshj += Convert.ToDouble(dt.Rows[i]["实检金额"]) * (Convert.ToInt32(dt.Rows[i]["实检人数"]) + Convert.ToInt32(dt.Rows[i]["未检人数"]));
|
|||
|
|
htpjzlzs += Convert.ToInt32(dt.Rows[i]["折率"]);
|
|||
|
|
yjzjhj += Convert.ToDouble(dt.Rows[i]["原价应检金额"]);
|
|||
|
|
}
|
|||
|
|
if (al != null)
|
|||
|
|
{
|
|||
|
|
foreach (t_ttsfjl d in al)
|
|||
|
|
{
|
|||
|
|
hkhj += d.jg_v;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
tbfzhj.Text = fzhj.ToString("0.00");
|
|||
|
|
tbhkhj.Text = hkhj.ToString("0.00");
|
|||
|
|
tbzqk.Text = (hkhj - fzhj).ToString("0.00");
|
|||
|
|
tbyshj.Text = yshj.ToString("0.00");
|
|||
|
|
tbhtpjzl.Text = (htpjzlzs / dt.Rows.Count).ToString() + "%";
|
|||
|
|
tbyjzjhj.Text = yjzjhj.ToString("0.00");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void radioButton3_CheckedChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
var service = ServiceContainer.GetService<It_ttgzb>();
|
|||
|
|
if (((RadioButton)sender).Checked == true)
|
|||
|
|
{
|
|||
|
|
switch (((RadioButton)sender).Text)
|
|||
|
|
{
|
|||
|
|
case "已检名单":
|
|||
|
|
tttgzbBindingSource.DataSource = service.GetList(htbm, "已检名单");
|
|||
|
|
tbrsCount.Text = service.GetList(htbm, "已检名单").Count.ToString();
|
|||
|
|
break;
|
|||
|
|
case "未检名单":
|
|||
|
|
tttgzbBindingSource.DataSource = service.GetList(htbm, "未检名单");
|
|||
|
|
tbrsCount.Text = service.GetList(htbm, "未检名单").Count.ToString();
|
|||
|
|
break;
|
|||
|
|
case "待查名单":
|
|||
|
|
tttgzbBindingSource.DataSource = service.GetList(htbm, "待查名单");
|
|||
|
|
tbrsCount.Text = service.GetList(htbm, "待查名单").Count.ToString();
|
|||
|
|
break;
|
|||
|
|
case "全部名单":
|
|||
|
|
tttgzbBindingSource.DataSource = service.GetList(htbm, "");
|
|||
|
|
tbrsCount.Text = service.GetList(htbm, "").Count.ToString();
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void button8_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
new ExcelDC().ExportExcel("团检人员列表", this.dgvhtyhList);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void button3_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
new ExcelDC().ExportExcel("团检统计", this.dataGridView1);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void button5_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
frmTuanJianzhiXingQingKuangChaXunJiaXiangMingXi mx = new frmTuanJianzhiXingQingKuangChaXunJiaXiangMingXi(htbm);
|
|||
|
|
mx.ShowDialog();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void button1_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
var service2 = ServiceContainer.GetService<It_jjxb>();
|
|||
|
|
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject(service2.GetDcjjxmxByhtbm(htbm), typeof(DataTable)) as DataTable;
|
|||
|
|
if (dt != null)
|
|||
|
|
{
|
|||
|
|
frmDcjjxmLiebiao fdl = new frmDcjjxmLiebiao();
|
|||
|
|
fdl.init(dt);
|
|||
|
|
fdl.re.Show();
|
|||
|
|
fdl.ShowDialog();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("该合同没有人员加项信息!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void dgvhtyhList_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
//double tjzje = Convert.ToDouble(dgvhtyhList.Rows[e.RowIndex].Cells["tjzjeDataGridViewTextBoxColumn"].Value);
|
|||
|
|
//if(tjzje>0)
|
|||
|
|
//{
|
|||
|
|
// dgvhtyhList.Rows[e.RowIndex].Cells["tjzjeDataGridViewTextBoxColumn"].Value = tjzje/100;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//var service = ServiceContainer.GetService<It_ttgzb>();
|
|||
|
|
//int htpjzlzs = 0; //合同平均折率总数
|
|||
|
|
//double fzhjs = 0;//分组合计
|
|||
|
|
//dts1 = Newtonsoft.Json.JsonConvert.DeserializeObject(service.GetListtjAll(htbm), typeof(DataTable)) as DataTable;
|
|||
|
|
|
|||
|
|
////dataGridView1.Rows[e.RowIndex].Cells["rsxj"].Value = lt.Where(t => t.htbm == htbm).Count().ToString();
|
|||
|
|
//dataGridView1.Rows[e.RowIndex].Cells["rsxj"].Value = lt.Select("htbm=" + htbm).Count();
|
|||
|
|
|
|||
|
|
////var rows = dts1.Select("htbm="+htbm);
|
|||
|
|
//if (dts1.Rows.Count>0)
|
|||
|
|
//{
|
|||
|
|
// foreach (DataRow row in dts1.Rows)
|
|||
|
|
// {
|
|||
|
|
// htpjzlzs += Convert.ToInt32(row["折率"]);
|
|||
|
|
// fzhjs += Convert.ToDouble(row["实检金额"]);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// dataGridView1.Rows[e.RowIndex].Cells["htpjzl"].Value = (htpjzlzs / dts1.Rows.Count).ToString() + "%";
|
|||
|
|
// dataGridView1.Rows[e.RowIndex].Cells["fzhj"].Value = fzhjs.ToString("0.00");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void dgvhtyhList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (tjzjeDataGridViewTextBoxColumn.Index == e.ColumnIndex)
|
|||
|
|
{
|
|||
|
|
if (Convert.ToDouble(e.Value.ToString()) > 0)
|
|||
|
|
{
|
|||
|
|
e.Value = Convert.ToDouble(e.Value.ToString()) / 100;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|