public void loadbangkebanhangtheongay(string ngaychungtu, string ngaycuoi, string manhanvien) { manhanvien = gen.GetString("select AccountingObjectID from AccountingObject where AccountingObjectID='" + manhanvien + "'"); DataTable temp = gen.GetTable("select substring(RefNo,4,12) as 'Số phiếu',JournalMemo as 'Đơn hàng', AccountingObjectCode as 'Mã khách', a.AccountingObjectName as 'Tên khách' ,a.AccountingObjectAddress as 'Địa chỉ',TotalAmountOC+TotalAmount-(TotalFreightAmount/(1+Cast(Tax as money)/100)) as 'Số tiền' from INOutward a, AccountingObject b where a.AccountingObjectID=b.AccountingObjectID and RefDate>='" + ngaychungtu + "' and RefDate<='" + ngaycuoi + "' and EmployeeIDSA='" + manhanvien + "' order by AccountingObjectCode"); Frm_nhapxuat F = new Frm_nhapxuat(); F.getdata(temp); F.getngay(ngaychungtu); F.getrole(manhanvien); F.gettsbt("bkthbhtnvkd"); F.ShowDialog(); }
public void loadbangkehangtheongayin(string ngaychungtu, string userid) { DataTable dt = new DataTable(); DataTable temp = new DataTable(); dt.Columns.Add("Mã hàng", Type.GetType("System.String")); dt.Columns.Add("Tên hàng", Type.GetType("System.String")); dt.Columns.Add("Số lượng", Type.GetType("System.Double")); dt.Columns.Add("Trọng lượng", Type.GetType("System.Double")); dt.Columns.Add("Khuyến mãi", Type.GetType("System.Double")); dt.Columns.Add("Đơn vị tính", Type.GetType("System.String")); string manhanvien = null; temp = gen.GetTable("select InventoryItemCode,InventoryItemName,SUM(Quantity),SUM(QuantityConvert),UnitPriceOC,sum(AmountOC),case when Quantity=0 then c.ConvertUnit else c.Unit end as loai,EmployeeIDSACode from INOutward a,INOutwardDetail b, InventoryItem c, (select * from OpeningAccountEntry131TT where EmployeeIDSAName='" + userid + "') d where a.RefNo=d.RefNo and a.RefID=b.RefID and b.InventoryItemID=c.InventoryItemID and RefType<>'1' group by InventoryItemCode,InventoryItemName,UnitPriceOC,EmployeeIDSACode,case when Quantity=0 then c.ConvertUnit else c.Unit end order by UnitPriceOC DESC,SUBSTRING(InventoryItemCode,8,2),InventoryItemCode"); for (int i = 0; i < temp.Rows.Count; i++) { DataRow dr = dt.NewRow(); dr[0] = temp.Rows[i][0]; dr[1] = temp.Rows[i][1]; if (Double.Parse(temp.Rows[i][4].ToString()) != 0) { dr[2] = temp.Rows[i][2]; dr[3] = temp.Rows[i][3]; } else { dr[4] = temp.Rows[i][3]; } dr[5] = temp.Rows[i][6]; manhanvien = temp.Rows[i][7].ToString(); dt.Rows.Add(dr); } if (manhanvien != null) { manhanvien = gen.GetString("select AccountingObjectID from AccountingObject where AccountingObjectCode='" + manhanvien + "'"); Frm_nhapxuat F = new Frm_nhapxuat(); F.getdata(dt); F.getngay(ngaychungtu); F.getrole(manhanvien); F.gettsbt("bkthbhtnvkdintong"); F.ShowDialog(); } }
public void loadbangkehangtheongayin(string ngaychungtu, string ngaycuoi, string manhanvien) { DataTable dt = new DataTable(); DataTable temp = new DataTable(); dt.Columns.Add("Mã hàng", Type.GetType("System.String")); dt.Columns.Add("Tên hàng", Type.GetType("System.String")); dt.Columns.Add("Số lượng", Type.GetType("System.Double")); dt.Columns.Add("Trọng lượng", Type.GetType("System.Double")); dt.Columns.Add("Khuyến mãi", Type.GetType("System.Double")); dt.Columns.Add("Đơn vị tính", Type.GetType("System.String")); temp = gen.GetTable("select InventoryItemCode,InventoryItemName,SUM(Quantity),SUM(QuantityConvert),UnitPriceOC,sum(AmountOC),case when Quantity=0 then c.ConvertUnit else c.Unit end as loai from INOutward a,INOutwardDetail b, InventoryItem c where a.RefID=b.RefID and b.InventoryItemID=c.InventoryItemID and RefDate>='" + ngaychungtu + "' and RefDate<='" + ngaycuoi + "' and EmployeeIDSA='" + manhanvien + "' and RefType<>'1' group by InventoryItemCode,InventoryItemName,UnitPriceOC,case when Quantity=0 then c.ConvertUnit else c.Unit end order by UnitPriceOC DESC,SUBSTRING(InventoryItemCode,8,2),InventoryItemCode"); for (int i = 0; i < temp.Rows.Count; i++) { DataRow dr = dt.NewRow(); dr[0] = temp.Rows[i][0]; dr[1] = temp.Rows[i][1]; if (Double.Parse(temp.Rows[i][4].ToString()) != 0) { dr[2] = temp.Rows[i][2]; dr[3] = temp.Rows[i][3]; } else { dr[4] = temp.Rows[i][3]; } dr[5] = temp.Rows[i][6]; dt.Rows.Add(dr); } Frm_nhapxuat F = new Frm_nhapxuat(); F.getdata(dt); F.getngay(ngaychungtu); F.getrole(manhanvien); F.gettsbt("bkthbhtnvkdintong"); F.ShowDialog(); }