//==== Tính toán public static long Tinh_Doanh_thu_Laptop(XmlElement Laptop) { var Doanh_thu = 0L; foreach (XmlElement Ban_hang in Laptop.GetElementsByTagName("Ban_hang")) { Doanh_thu += long.Parse(Ban_hang.GetAttribute("Tien")); } return(Doanh_thu); }
public static long Tinh_Doanh_thu_San_pham_Nam_hien_hanh(XmlElement San_pham, DateTime Ngay) { var Doanh_thu = 0L; foreach (XmlElement Ban_hang in San_pham.GetElementsByTagName("Ban_hang")) { var Ngay_Ban = DateTime.Parse(Ban_hang.GetAttribute("Ngay")); if (Ngay.Year == Ngay_Ban.Year) { Doanh_thu += long.Parse(Ban_hang.GetAttribute("Tien")); } } return(Doanh_thu); }
public static long Tinh_Doanh_thu_Lap_top(XmlElement Lap_top, DateTime Ngay) { var Doanh_thu = 0L; foreach (XmlElement Ban_hang in Lap_top.GetElementsByTagName("Ban_hang")) { var Ngay_Ban = DateTime.Parse(Ban_hang.GetAttribute("Ngay")); if (Ngay.Day == Ngay_Ban.Day && Ngay.Month == Ngay_Ban.Month && Ngay.Year == Ngay_Ban.Year) { Doanh_thu += long.Parse(Ban_hang.GetAttribute("Tien")); } } return(Doanh_thu); }
public static long Tinh_So_luong_ton_Laptop(XmlElement Laptop) { var Ton_Kho = 0L; var So_Ban = 0L; var So_Nhap = 0L; foreach (XmlElement Ban_hang in Laptop.GetElementsByTagName("Ban_hang")) { So_Ban += long.Parse(Ban_hang.GetAttribute("So_luong")); } foreach (XmlElement Nhap_hang in Laptop.GetElementsByTagName("Nhap_hang")) { So_Nhap += long.Parse(Nhap_hang.GetAttribute("So_luong")); } Ton_Kho = So_Nhap - So_Ban; return(Ton_Kho); }
//==== Tính toán ====== public static long Tinh_So_luong_Ton_San_pham(XmlElement San_pham) { var Tong_Nhap_hang = 0L; foreach (XmlElement Nhap_hang in San_pham.GetElementsByTagName("Nhap_hang")) { Tong_Nhap_hang += long.Parse(Nhap_hang.GetAttribute("So_luong")); } var Tong_Ban_hang = 0L; foreach (XmlElement Ban_hang in San_pham.GetElementsByTagName("Ban_hang")) { Tong_Ban_hang += long.Parse(Ban_hang.GetAttribute("So_luong")); } var So_luong_Ton = Tong_Nhap_hang - Tong_Ban_hang; return(So_luong_Ton); }