示例#1
0
        private void f_SALEDataGridView_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
        {
            DataClassLinqDataContext linqd = new DataClassLinqDataContext();
            var k = (from q in linqd.F_INCOME
                     select new
            {
                huohao = q.货号,
                diaopai = q.进货价
            }).Distinct().ToList();

            if (this.f_SALEDataGridView.Rows.Count == 0)
            {
                return;
            }

            decimal allMount = 0;
            decimal allLiren = 0;

            foreach (DataGridViewRow dr in this.f_SALEDataGridView.Rows)
            {
                if (((int)dr.Cells["销量"].Value) > 0)
                {
                    dr.Cells["进销"].Value = "销售";
                }
                else
                if (((int)dr.Cells["销量"].Value) == 0)
                {
                    dr.DefaultCellStyle.BackColor = Color.MistyRose;
                }
                else
                {
                    dr.Cells["进销"].Value          = "退货";
                    dr.DefaultCellStyle.BackColor = Color.Cyan;
                }
                dr.Cells["成本价"].Value = k.Where(p => p.huohao == dr.Cells["货号"].Value.ToString()).Select(p => p.diaopai).First();
                dr.Cells["毛利"].Value  = ((decimal)dr.Cells["开票价"].Value - (decimal)dr.Cells["成本价"].Value) * (int)dr.Cells["销量"].Value;

                allMount += (int)dr.Cells["销量"].Value;
                allLiren += (decimal)dr.Cells["毛利"].Value;
            }
            this.label总件数.Text = allMount.ToString();
            this.label总毛利.Text = allLiren.ToString();
        }
示例#2
0
        /// <summary>
        /// 根据货号找到库存中的产品资料
        /// </summary>
        /// <param name="huohao"></param>
        /// <returns></returns>
        public static List <productBasic> getProductByHuohao(string huohao)
        {
            DataClassLinqDataContext dl = new DataClassLinqDataContext();

            var s =
                from o in dl.F_CLASS
                from p in o.F_INCOME
                where p.货号 == huohao && p.进货数量 > 0
                select new productBasic
            {
                颜色货号锁定 = (bool)o.颜色货号锁定,
                季节     = p.季节,
                品牌     = p.品牌,
                类型     = p.类型,
                颜色     = p.颜色,
                牌价     = p.牌价,
                进货价    = p.进货价
            };

            return(s.ToList());
        }