示例#1
0
    //==== 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);
    }
示例#2
0
    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);
    }
示例#3
0
    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);
    }
示例#4
0
    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);
    }
示例#5
0
    //==== 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);
    }