private void MatComboBox_EditValueChanged(object sender, EventArgs e) { var row = (GetPosOutView)MatComboBox.GetSelectedDataRow(); if (row != null) { GetPosOutBS.DataSource = row; var wid = _def_wid != null ? _def_wid.Value : row.WID; _wbd.Price = row.Price; BotPriceEdit.EditValue = row.Price; _wbd.BasePrice = row.Price + row.Price * row.Nds / 100; _wbd.Nds = row.Nds; _wbd.CurrId = row.CurrId; _wbd.OnValue = row.OnValue; _wbd.OnDate = row.OnDate; _wbd.WId = wid; _wbd.MatId = row.MatId; ordered_in_list = _db.GetShippedPosIn(row.PosId).ToList(); WHComboBox.EditValue = wid; } GetOk(); }
private void GetOk() { var row = MatComboBox.GetSelectedDataRow() as make_det; if (row != null) { var plan_weighing = Math.Round(Convert.ToDecimal((row.AmountByRecipe * _iw.Amount) / row.TotalWeightByRecipe), 2); ByRecipeEdit.EditValue = row.AmountByRecipe; IntermediateWeighingEdit.EditValue = row.AmountIntermediateWeighing; TotalEdit.EditValue = row.AmountByRecipe - (row.AmountIntermediateWeighing ?? 0); var deviation = _db.MatRecDet.FirstOrDefault(w => w.MatId == row.MatId && w.RecId == row.RecId)?.Deviation ?? 1000000; var vizok = (dynamic)TareMatEdit.GetSelectedDataRow(); var netto_amount = AmountEdit.Value - TaraCalcEdit.Value - (vizok != null ? vizok.Weight : 0); CalcAmount.EditValue = plan_weighing + TaraCalcEdit.Value + (vizok != null ? vizok.Weight : 0); OkButton.Enabled = !String.IsNullOrEmpty(MatComboBox.Text) && ((plan_weighing + deviation) >= netto_amount && (plan_weighing - deviation) <= netto_amount); // && (TotalEdit.Value + deviation) >= netto_amount; } else { OkButton.Enabled = false; } }
private void OkButton_Click(object sender, EventArgs e) { var pos_out_row = (GetPosOutView)MatComboBox.GetSelectedDataRow(); bool stop = false; int num = _wbd.Num; decimal amount = _wbd.Amount; foreach (var item in ordered_in_list.Where(w => w.Remain > 0)) { if (!stop) { var t_wbd = _db.WaybillDet.Add(new WaybillDet { WbillId = _wb.WbillId, Price = pos_out_row.Price, BasePrice = pos_out_row.Price + pos_out_row.Price * pos_out_row.Nds / 100, Nds = pos_out_row.Nds, CurrId = pos_out_row.CurrId, OnValue = pos_out_row.OnValue, OnDate = pos_out_row.OnDate, WId = _wbd.WId, MatId = item.MatId, Num = ++num }); if (item.Remain >= amount) { t_wbd.Amount = amount; stop = true; } else { t_wbd.Amount = item.Remain.Value; amount -= item.Remain.Value; } _db.SaveChanges(); _db.ReturnRel.Add(new ReturnRel { PosId = t_wbd.PosId, OutPosId = pos_out_row.PosId, PPosId = item.PosId }); } _temp_return_rel = null; } var fff = _db.Entry <WaybillDet>(_wbd).State; if (_db.Entry <WaybillDet>(_wbd).State != EntityState.Detached) { _db.WaybillDet.Remove(_wbd); } _db.SaveChanges(); }
private void SetValue() { var item = MatComboBox.GetSelectedDataRow() as WhMatGet_Result; _wbd.MatId = item.MatId; _wbd.Amount = item.Remain.Value; _wbd.Price = item.AvgPrice; _wbd.Discount = item.Remain; _wbd.Nds = item.AvgPrice; _wbd.BasePrice = item.AvgPrice; WaybillDetBS.DataSource = _wbd; }
bool GetOk() { var pos_out_row = (GetPosOutView)MatComboBox.GetSelectedDataRow(); bool recult = (pos_out_row != null && AmountEdit.Value <= pos_out_row.Remain && pos_out_list != null && MatComboBox.EditValue != DBNull.Value && WHComboBox.EditValue != DBNull.Value /*&& BasePriceEdit.EditValue != DBNull.Value*/ && AmountEdit.EditValue != DBNull.Value); OkButton.Enabled = recult; TotalSumEdit.EditValue = (AmountEdit.EditValue != DBNull.Value ? Convert.ToDecimal(AmountEdit.EditValue) : 0) * _wbd.Price; SummAllEdit.EditValue = (AmountEdit.EditValue != DBNull.Value ? Convert.ToDecimal(AmountEdit.EditValue) : 0) * _wbd.BasePrice; TotalNdsEdit.EditValue = Convert.ToDecimal(SummAllEdit.EditValue) - Convert.ToDecimal(TotalSumEdit.EditValue); return(recult); }
private void MatComboBox_EditValueChanged(object sender, EventArgs e) { var row = (WhMatGet_Result)MatComboBox.GetSelectedDataRow(); if (row == null) { return; } if (MatComboBox.ContainsFocus) { _wbd.MatId = row.MatId; GetContent(); } labelControl24.Text = row.MsrName; labelControl27.Text = row.MsrName; }
private void RecipeComboBox_EditValueChanged(object sender, EventArgs e) { if (!MatComboBox.ContainsFocus) { return; } var row = MatComboBox.GetSelectedDataRow() as make_det; if (row == null) { return; } det.MatId = row.MatId; GetOk(); }
private void simpleButton2_Click(object sender, EventArgs e) { var row = (GetPosOutView)MatComboBox.GetSelectedDataRow(); int matId = row != null ? row.MatId : 0; using (var frm = new frmOutMatList(_db, _start_date, _wb.OnDate, matId, _wb.KaId.Value)) { if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { pos_out_list = frm.pos_out_list; MatComboBox.Properties.DataSource = frm.pos_out_list; if (pos_out_list != null) { var mat_row = frm.bandedGridView1.GetFocusedRow() as GetPosOutView; MatComboBox.EditValue = mat_row.PosId; } } } }
private void MatComboBox_EditValueChanged(object sender, EventArgs e) { var row = (MaterialsList)MatComboBox.GetSelectedDataRow(); if (row == null) { return; } if (MatComboBox.ContainsFocus) { _wbd.WId = row.WId; _wbd.Nds = row.NDS == 1 ? DBHelper.CommonParam.Nds : 0; _wbd.MatId = row.MatId; ProducerTextEdit.EditValue = row.Produced; } labelControl24.Text = row.MeasuresName; labelControl27.Text = row.MeasuresName; var sate = _db.Entry(_wbd).State; PriceTypesEdit.EditValue = PriceTypesEdit.EditValue == DBNull.Value ? (_db.Entry(_wbd).State == EntityState.Detached ? _db.PriceTypes.First(w => w.Def == 1).PTypeId : PriceTypesEdit.EditValue) : PriceTypesEdit.EditValue; if (PriceTypesEdit.EditValue != DBNull.Value) { var list_price = _db.GetListMatPrices(row.MatId, _wb.CurrId, (int)PriceTypesEdit.EditValue).FirstOrDefault(); if (list_price != null) { _wbd.BasePrice = list_price.Price != null?Math.Round(list_price.Price.Value, 4) : 0; BasePriceEdit.Value = _wbd.BasePrice.Value; } } GetDiscount(row.MatId); GetContent(_wbd.WId, row.MatId); SetAmount(); GetOk(); }
private void MatComboBox_EditValueChanged(object sender, EventArgs e) { var row = (MaterialsList)MatComboBox.GetSelectedDataRow(); if (row != null) { // _wbd.Nds = row.NDS; треба подумати як правильно _wbd.WId = row.WId; labelControl24.Text = row.MeasuresName; labelControl27.Text = row.MeasuresName; GetRemains(); if (MatComboBox.ContainsFocus) { ProducerTextEdit.EditValue = row.Produced; SetPrice(row.MatId); } } GetOk(); }
private void GetContent() { if (_wbd.WId == null || _wbd.MatId == 0) { return; } var row = (WhMatGet_Result)MatComboBox.GetSelectedDataRow(); mat_remain = _materials_on_wh.Where(w => w.WId == _wbd.WId && w.MatId == _wbd.MatId).Select(s => new GetActualRemainByWh_Result { CurRemainInWh = s.Remain - s.Rsv, Rsv = row != null ? row.Rsv : 0, Remain = row != null ? row.Remain : 0 }).FirstOrDefault(); // _db.GetActualRemainByWh(_wbd.WId, _wbd.MatId).FirstOrDefault(); if (mat_remain != null) { RemainWHEdit.EditValue = mat_remain.CurRemainInWh; RsvEdit.EditValue = mat_remain.Rsv; CurRemainEdit.EditValue = mat_remain.Remain; } }
private void OkButton_Click(object sender, EventArgs e) { String str = ""; if (checkEdit2.Checked) { str += "1"; } if (checkEdit1.Checked) { str += ",5"; } if (checkEdit3.Checked) { str += ",6"; } if (checkEdit4.Checked) { str += ",-1"; } if (checkEdit5.Checked) { str += ",-6"; } if (checkEdit6.Checked) { str += ",-5"; } if (checkEdit7.Checked) { str += ",-20"; } if (checkEdit8.Checked) { str += ",-22"; } if (checkEdit9.Checked) { str += ",-24"; } SetDate(); int grp = ChildGroupCheckEdit.Checked ? Convert.ToInt32((GrpComboBox.GetSelectedDataRow() as dynamic).GrpId) : 0; /* var pr = new PrintReport * { * OnDate = OnDateDBEdit.DateTime, * StartDate = StartDateEdit.DateTime, * EndDate = EndDateEdit.DateTime, * MatGroup = GrpComboBox.GetSelectedDataRow(), * Kagent = KagentComboBox.GetSelectedDataRow(), * Warehouse = WhComboBox.GetSelectedDataRow(), * Material = MatComboBox.GetSelectedDataRow(), * DocStr = str, * DocType = DocTypeEdit.EditValue, * ChType = ChTypeEdit.GetSelectedDataRow(), * Status = wbStatusList.EditValue, * KontragentGroup = GrpKagentLookUpEdit.GetSelectedDataRow(), * GrpStr = ChildGroupCheckEdit.Checked ? String.Join(",", new BaseEntities().GetMatGroupTree(grp).ToList().Select(s => Convert.ToString(s.GrpId))) : "", * Person = PersonLookUpEdit.GetSelectedDataRow() * }; * * pr.CreateReport(_rep_id);*/ var pr2 = new PrintReportv2(_rep_id, DBHelper.CurrentUser.KaId, DBHelper.CurrentUser.UserId) { OnDate = OnDateDBEdit.DateTime, StartDate = StartDateEdit.DateTime, EndDate = EndDateEdit.DateTime, MatGroup = GrpComboBox.GetSelectedDataRow() as GrpComboBoxItem, Kagent = KagentComboBox.GetSelectedDataRow() as KagentComboBoxItem, Warehouse = WhComboBox.GetSelectedDataRow() as WhComboBoxItem, Material = MatComboBox.GetSelectedDataRow() as MatComboBoxItem, DocStr = str, DocType = DocTypeEdit.EditValue, ChType = ChTypeEdit.GetSelectedDataRow() as ChTypeComboBoxItem, Status = wbStatusList.EditValue, KontragentGroup = GrpKagentLookUpEdit.GetSelectedDataRow() as GrpKagentComboBoxItem, GrpStr = ChildGroupCheckEdit.Checked ? String.Join(",", new BaseEntities().GetMatGroupTree(grp).ToList().Select(s => Convert.ToString(s.GrpId))) : "", Person = PersonLookUpEdit.GetSelectedDataRow() }; var template_name = pr2.GetTemlate(_rep_id); var template_file = Path.Combine(IHelper.template_path, template_name); if (File.Exists(template_file)) { var report_data = pr2.CreateReport(template_file, DBHelper.CurrentUser.ReportFormat); if (report_data != null) { IHelper.ShowReport(report_data, template_name); } else { MessageBox.Show("За обраний період звіт не містить даних !"); } } else { MessageBox.Show("Шлях до шаблонів " + template_file + " не знайдено!"); } }