private void button1_Click(object sender, EventArgs e)
{
hesham2020Entities2 db = new hesham2020Entities2();
string u;
u = textBox1.Text.Trim();
var y = from s in db.invoice_head.Where(c=>c.invno==u)
join x in db.inv_detail on s.invno equals x.inv_no
select new { x.unit, x.qty, x.p_no, x.description, x.price, x.tot_price,s.customer_id, s.invno,s.inv_dat,s.po_no,s.total };
CrystalReport6 crt = new CrystalReport6();
crt.SetDataSource(y);
crt.SetParameterValue(0, comboBox2.SelectedItem);
crt.SetParameterValue(1, comboBox3.SelectedItem);
crv9.ReportSource = crt;
crv9.Refresh();
}
此代码用于打印销售发票,如果打印的发票包含一行,则尝试打印每一行;如果包含的行超过一行,则尝试复制每行,并重复每行,其中包含发票行数每行2行打印2次,如果包含3行每行打印3次..etc。