0% found this document useful (0 votes)
4K views2 pages

New Text Document

Uploaded by

Alipok
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4K views2 pages

New Text Document

Uploaded by

Alipok
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

private void simpleButton1_Click(object sender, EventArgs e)

{
if (IsDataVailde())
{
Save();
PrintA4();
}

}
void PrintA4()
{
using (var db = new DAL.dbDataContext())
{
var invoice = (from inv in db.InvoiceHeaders.Where(x => x.ID ==
Invoice.ID)
join prt in db.CustomersAndVendors on inv.PartID
equals prt.ID
select new
{
inv.ID,
inv.Code,
// Store = str.Name,
// Drawer = drw.Name,
PartName = prt.Name,
Phone = prt.Phone,
totalCredit = prt.Credit,
Credit = prt.Credit - inv.Remaing,
prt.NumberR,
prt.CFN,
prt.registerN,
prt.Address,
Date = inv.Date.Date,
inv.DiscountValue,
inv.DiscountRation,
inv.Expences,
//InvoiceType =
//(inv.InvoiceType ==
(byte)Master.InvoiceType.Purchase) ? "‫ " فاتوره مشتريات‬:
//(inv.InvoiceType ==
(byte)Master.InvoiceType.Sales) ? "‫ " فاتوره مبيعات‬:
//(inv.InvoiceType ==
(byte)Master.InvoiceType.SalesReturn) ? "‫ " فاتوره مردود مبيعات‬:
//(inv.InvoiceType ==
(byte)Master.InvoiceType.PurchaseReturn) ? "‫ " فاتوره مردود مشتريات‬: "UnDefined",
inv.Net,
inv.Notes,
inv.Paid,
PartType =
(inv.PartType ==
(byte)Master.PartType.Customer) ? "‫ "عميل‬:
(inv.PartType == (byte)Master.PartType.Vendor) ?
"‫ "مورد‬: "UnDefined",
inv.Remaing,
inv.TaxValue,
inv.Total,
ProductCount = db.InvoiceDetails.Where(x =>
x.InoiceID == inv.ID).Count(),
Products = (
from d in db.InvoiceDetails.Where(x => x.InoiceID
== inv.ID)
from p in db.Products.Where(x => x.ID == d.ItemID)
from u in db.UnitNames.Where(x => x.ID ==
d.ItemUnitID).DefaultIfEmpty()
select new
{
ProductName = p.Name,
UnitName = u.Name,
d.ItemQty,
d.Price,
d.TotalPrice,
}).ToList()
}).ToList();
var s = invoice.First();

// MessageBox.Show(s.Credit.ToString());

Reporting.rpt_InvoiceA4.Print(invoice, s.totalCredit);
}

You might also like