示例#1
0
        private void Calculate(int month)
        {
            SortableBindingList <CMonthlyIncome> list = new SortableBindingList <CMonthlyIncome>();

            foreach (var vr in this.damaiDataSet.Shipment)
            {
                if (vr.IsShipTimeNull())
                {
                    continue;
                }
                if (vr.ShipTime.Month != month)
                {
                    continue;
                }
                if (vr.ShipTime.Year != MyFunction.IntHeaderYear)
                {
                    continue;
                }
                if (vr.IsCustomerNull())
                {
                    continue;
                }
                if (!vr.IsRemovedNull())
                {
                    if (vr.Removed)
                    {
                        continue;
                    }
                }

                int            id = vr.Customer;
                CMonthlyIncome p  = FindOrAdd(vr.Customer, list);
                // if (!vr.IsLockedNull()&&vr.Locked) p.ShipmentCount++;
                if (!vr.IsCheckedNull() && vr.Checked)
                {
                    p.ShipmentCount++;
                }
                if (!vr.IsCostNull())
                {
                    p.Money += vr.Cost;
                }
            }
            dgViewMonthlyIncome.DataSource = list;
            decimal total = 0;

            foreach (CMonthlyIncome p in list)
            {
                total += p.Money;
            }
            textBoxTotal.Text     = total.ToString("F1");
            labelWarning1.Visible = false;
            labelWarning2.Visible = false;
        }
示例#2
0
        CMonthlyIncome FindOrAdd(int id, SortableBindingList <CMonthlyIncome> list)
        {
            foreach (CMonthlyIncome p in list)
            {
                if (p.CustomerID == id)
                {
                    return(p);
                }
            }
            CMonthlyIncome pay = new CMonthlyIncome();

            pay.CustomerID = id;
            list.Add(pay);
            return(pay);
        }