public XmlElement PrepareSoldZednadebiEasy(Zednadebi arg_zed, int arg_id, Buyer arg_buyer, string arg_start_address, DateTime arg_delivery_date, int arg_seller_un_id, int arg_s_user_id ) { return(PrepareZednadebi(arg_zed, arg_id, arg_zed.operation_type, arg_buyer, 1, arg_start_address, arg_buyer.address, "", 1, "", 0, "", "", arg_delivery_date, 1, arg_seller_un_id, 0, "", arg_s_user_id, arg_zed.dro, 2, 167, "", "" )); }
private void btn_get_from_rs_ge_Click(object sender, EventArgs e) { ChooseRSIncomingZed frmRcvZed = new ChooseRSIncomingZed(); frmRcvZed.evtWaybillChosen += new ChooseRSIncomingZed.WaybillChosenHandler (delegate(ChooseRSIncomingZed frmChooseRSIncomingZed, WBChosenEventArgs eWbSuccess) { Zednadebi zedloadedetcetc = eWbSuccess.WBChosenZed; MessageBox.Show("TODO: load zed and rems into datagridview"); }); frmRcvZed.ShowDialog(); }
private void btn_rs_ge_send_Click(object sender, EventArgs e) { if (false == (buyer_chooser.SelectedIndex >= 0 && buyer_chooser.SelectedIndex < all_buyers.Length)) { MessageBox.Show("მყიდველის ველი ცარიელია!"); return; } else if (false) { MessageBox.Show("Zednadebi is not saveable, compared to database!"); return; } else { DataProvider.PaymentType paying_method_now = DataProvider.PaymentType.Nagdi; if ("ნაღდი" == ckb_pay_method.Text) { paying_method_now = DataProvider.PaymentType.Nagdi; } else if ("კონსიგნაცია" == ckb_pay_method.Text) { paying_method_now = DataProvider.PaymentType.Konsignacia; } else if ("უნაღდო" == ckb_pay_method.Text) { paying_method_now = DataProvider.PaymentType.Unagdo; } Zednadebi zed_to_send = new Zednadebi("", zed_dro_datechooser.Value, add_rem_af_seria.Text, add_rem_af_nomeri.Text, DataProvider.OperationType.Sell, all_buyers[buyer_chooser.SelectedIndex].saidentifikacio_kodi, paying_method_now); zed_to_send.OrderedItemList = GetAllEnteredRemainders(); SendSoldZedToRS frmSendZedToRS = new SendSoldZedToRS(); frmSendZedToRS.InitSendZed(zed_to_send); frmSendZedToRS.evtSaveSuccess += new SendSoldZedToRS.WaybillSaveSuccessHandler(delegate(SendSoldZedToRS frmSoldZed, WaybillSuccessArgs eWbSuccess) { MessageBox.Show("ზედნადების rs.ge-ზე დამახსოვრება ნომრით \"" + eWbSuccess.sInsertedZedIdent + "\" წარმატებით დასრულდა!"); /* * zed_ident_code_txt.Enabled = false; * buyer_chooser.Enabled = false; * zed_dro_datechooser.Enabled = false; * add_remainders_list.Enabled = false; */ zed_ident_code_txt.Text = eWbSuccess.sInsertedZedIdent; //click submit btn }); frmSendZedToRS.ShowDialog(); } }
private void ChooseRSIncomingZed_Load(object sender, EventArgs e) { FindIncomingWaybill frmFindIncomingWB = new FindIncomingWaybill(); frmFindIncomingWB.evtWaybillIDSelected += new FindIncomingWaybill.WaybillIDSelectedHandler (delegate(FindIncomingWaybill frmFindIncomingWaybill, WBIDSelectedEventArgs eWBIDSelected) { Zednadebi SelectedZed = ProductInfo_Main_Form.rsge.LoadWaybill(eWBIDSelected.Waybill_ID); if (null == SelectedZed) { MessageBox.Show("ზედნადები არასწორადაა გადაცემული!"); this.Close(); } else { txt_rs_zed_ident.Text = SelectedZed.zednadebis_nomeri; txt_rs_buyer_ident.Text = SelectedZed.supplier_saident; txt_rs_buyer_name.Text = "Not Implemented"; foreach (Remainder r in SelectedZed.OrderedItemList) { table_incoming_zeds.Rows.Add(new object[] { r.product_barcode, r.product_barcode, r.initial_pieces, r.sell_price }); } // } });//end FindIncomingWaybill.evtWaybillIDSelected //placeholder for zednadebi downloaded from rs.ge //Zednadebi IncomingZed = ProductInfo_Main_Form.conn.GetZednadebi // ("001", DataProvider.OperationType.Buy.ToString(), "123123123"); }
// private void submit_btn_Click(object sender, EventArgs e) { submit_clicked = true; Zednadebi shetana_zed = null; AngarishFaqtura shetana_af = null; List <Remainder> zed_prod_list = new List <Remainder>(); if (supplier_chooser.SelectedIndex >= 0 && supplier_chooser.SelectedIndex < all_suppliers.Length) { if ("" == zed_ident_code_txt.Text) { MessageBox.Show("ზედნადების საიდენტიფიკაციო კოდი არ არის მითითებული!"); return; } shetana_zed = new Zednadebi(zed_ident_code_txt.Text, zed_dro_datechooser.Value, add_rem_af_seria.Text, add_rem_af_nomeri.Text, DataProvider.OperationType.Buy, all_suppliers[supplier_chooser.SelectedIndex].saidentifikacio_kodi, DataProvider.PaymentType.Nagdi); } else { MessageBox.Show("მომწოდებელი არ არის მითითებული!"); return; } foreach (DataGridViewRow nextRow in add_remainders_list.Rows) { if (!nextRow.IsNewRow) { Remainder nextRemS1 = new Remainder(); if (null == nextRow.Cells[add_rem_barcode_col.Index].Value | null == nextRow.Cells[add_rem_capacity_col.Index].Value | null == nextRow.Cells[add_rem_count_type_col.Index].Value | null == nextRow.Cells[add_rem_storeid_col.Index].Value | 0 >= Convert.ToInt32((nextRow.Cells[add_rem_storeid_col.Index].Value ?? 0).ToString()) | null == nextRow.Cells[add_rem_piece_count_col.Index].Value | null == nextRow.Cells[add_rem_piece_price_col.Index].Value | 0 > ParseDecimal((nextRow.Cells[add_rem_sell_price_col.Index].Value ?? 0).ToString())) { HighlightNonCompleteFields(nextRow); status_bar_lbl.Text = "გთხოვთ შეავსოთ აუცილებელი ველები!"; return; } else { string nbarcode = nextRow.Cells[add_rem_barcode_col.Index].Value.ToString(); string nzedid = zed_ident_code_txt.Text; decimal ncapacity = ParseDecimal(nextRow.Cells[add_rem_capacity_col.Index].Value.ToString()); decimal npiece_price = ParseDecimal(nextRow.Cells[add_rem_piece_price_col.Index].Value.ToString()); int nstore_id = 0; decimal npiece_count = 0.0m; decimal nsell_price = 0.0m; nstore_id = Convert.ToInt32(nextRow.Cells[add_rem_storeid_col.Index].Value.ToString()); npiece_count = ParseDecimal(nextRow.Cells[add_rem_piece_count_col.Index].Value.ToString()); nsell_price = ParseDecimal((nextRow.Cells[add_rem_sell_price_col.Index].Value ?? 0).ToString()); if ("ყუთები" == nextRow.Cells[add_rem_count_type_col.Index].Value.ToString()) { npiece_count *= ncapacity; } else { } nextRemS1.storehouse_id = nstore_id; nextRemS1.product_barcode = nbarcode; nextRemS1.supplier_ident = all_suppliers[supplier_chooser.SelectedIndex].saidentifikacio_kodi; nextRemS1.zednadebis_nomeri = nzedid; nextRemS1.pack_capacity = ncapacity; nextRemS1.buy_price = npiece_price; nextRemS1.formal_buy_price = npiece_price; nextRemS1.sell_price = nsell_price; nextRemS1.formal_sell_price = nsell_price; nextRemS1.initial_pieces = npiece_count; nextRemS1.remaining_pieces = npiece_count; if (npiece_count > 0) { zed_prod_list.Add(nextRemS1); } } } else { //Last, unused row (IsNewRow) } }//foreach datagridviewrow if (!(zed_prod_list.Count > 0)) { status_bar_lbl.Text = "პროდუქტების სიის გარეშე გაყიდვა არ მოხდება!"; return; } PurchaseOrder shemotana_pur; if (using_af_ckb.Checked && "" != add_rem_af_seria.Text && "" != add_rem_af_nomeri.Text) { shetana_af = new AngarishFaqtura(add_rem_af_seria.Text, add_rem_af_nomeri.Text, add_rem_af_date_chooser.Value, DataProvider.OperationType.Buy, all_suppliers[supplier_chooser.SelectedIndex].saidentifikacio_kodi); shemotana_pur = new PurchaseOrder(DateTime.Now, all_suppliers[supplier_chooser.SelectedIndex], shetana_zed, zed_prod_list.ToArray(), shetana_af); } else { shemotana_pur = new PurchaseOrder(DateTime.Now, all_suppliers[supplier_chooser.SelectedIndex], shetana_zed, zed_prod_list.ToArray(), null); } info trans_res = ProductInfo_Main_Form.conn.AddPurchaseOrder(shemotana_pur); MessageBox.Show(trans_res.errcode.ToString() + ":" + trans_res.details); //MessageBox.Show("TODO in DataProvider: SPROC RETVAL??? " + trans_res.errcode.ToString() + ":" + trans_res.details); if (501 == trans_res.errcode | 0 == trans_res.errcode) { MessageBox.Show("ზედნადები დამატებულია."); this.Close(); } else { MessageBox.Show("მოხდა შეცდომა. ზედნადები არ დამატებულა! "); } }
private void submit_btn_Click() { submit_clicked = true; Zednadebi gayidva_zed = null; AngarishFaqtura gayidva_af = null; List <Remainder> zed_prod_list = new List <Remainder>(); DataProvider.PaymentType paying_method_now = DataProvider.PaymentType.Nagdi; if ("ნაღდი" == ckb_pay_method.Text) { paying_method_now = DataProvider.PaymentType.Nagdi; } else if ("კონსიგნაცია" == ckb_pay_method.Text) { paying_method_now = DataProvider.PaymentType.Konsignacia; } else if ("უნაღდო" == ckb_pay_method.Text) { paying_method_now = DataProvider.PaymentType.Unagdo; } if (buyer_chooser.SelectedIndex >= 0 && buyer_chooser.SelectedIndex < all_buyers.Length) { if ("" == zed_ident_code_txt.Text) { MessageBox.Show("ზედნადების საიდენტიფიკაციო კოდი არ არის მითითებული!"); return; } gayidva_zed = new Zednadebi(zed_ident_code_txt.Text, zed_dro_datechooser.Value, add_rem_af_seria.Text, add_rem_af_nomeri.Text, DataProvider.OperationType.Sell, all_buyers[buyer_chooser.SelectedIndex].saidentifikacio_kodi, paying_method_now); } else { MessageBox.Show("მყიდველი არ არის მითითებული!"); return; } zed_prod_list = GetAllEnteredRemainders(); if (zed_prod_list.Count <= 0) { MessageBox.Show("ცარიელი ზედნადების გაყიდვა არაა დაშვებული!"); return; } if (zed_prod_list.Count > 23) { MessageBox.Show("ზედნადების ფორმით 23–ზე მეტი პროდუქტის გაყიდვა არაა დაშვებული!"); return; } SellOrder shemotana_SO; if (using_af_ckb.Checked && "" != add_rem_af_seria.Text && "" != add_rem_af_nomeri.Text) { gayidva_af = new AngarishFaqtura(add_rem_af_seria.Text, add_rem_af_nomeri.Text, add_rem_af_date_chooser.Value, DataProvider.OperationType.Sell, all_buyers[buyer_chooser.SelectedIndex].saidentifikacio_kodi); shemotana_SO = new SellOrder(gayidva_zed.dro, true, paying_method_now, all_buyers[buyer_chooser.SelectedIndex], gayidva_zed, zed_prod_list.ToArray(), gayidva_af); } else { shemotana_SO = new SellOrder(gayidva_zed.dro, true, paying_method_now, all_buyers[buyer_chooser.SelectedIndex], gayidva_zed, zed_prod_list.ToArray(), null); } //this variable will be initialized by the AddSellOrder call, but not neccessery in this code because this SellOrder is Zednadebi (Invoice) int SellOrderInsertID; info trans_res = ProductInfo_Main_Form.conn.AddSellOrder(shemotana_SO, out SellOrderInsertID); MessageBox.Show("TODO in DataProvider: SPROC RETVAL??? " + trans_res.errcode.ToString() + ":" + trans_res.details); if (501 == trans_res.errcode | 0 == trans_res.errcode) { MessageBox.Show("ზედნადები გაყიდულია."); if (DataProvider.PaymentType.Nagdi == paying_method_now) { decimal selling_rem_sum = 0.0m; //(from z_nextrem in zed_prod_list //select (z_nextrem.sell_price * z_nextrem.initial_pieces)).Sum(); foreach (Remainder next_selling_rem in zed_prod_list.ToArray()) { selling_rem_sum += next_selling_rem.sell_price * next_selling_rem.initial_pieces; } //gayidulis gadaricxva info payforsellingzed_info = ProductInfo_Main_Form.conn.TransferMoney( all_buyers[buyer_chooser.SelectedIndex].saidentifikacio_kodi , DataProvider.MoneyTransferType.Take , DateTime.Now , selling_rem_sum , typeof(Buyer) , DataProvider.MoneyTransferPurpose.PayFor , cb_mt_store_id.SelectedIndex , typeof(Zednadebi) , zed_ident_code_txt.Text //zednadebistvis gadaxdaze mgoni ar girs gaformeba cashier-ze da cashbox-ze , 0 //ProductInfo_Main_Form.ActiveCashBoxID , 0 //ProductInfo_Main_Form.ActiveCashierID ); MessageBox.Show(payforsellingzed_info.details, payforsellingzed_info.errcode.ToString()); } this.Close(); } else if (404 == trans_res.errcode) { MessageBox.Show("ამ რაოდენობის პროდუქტები საწყობში აღარაა დარჩენილი! "); } else { MessageBox.Show("მოხდა შეცდომა. ზედნადები არ გაყიდულა! "); } }
internal void InitSendZed(Zednadebi arg_zed_to_send) { zedToSend = arg_zed_to_send; }
/// <summary> /// /// </summary> /// <param name="arg_zed"></param> /// <param name="arg_id"></param> /// <param name="arg_type"></param> /// <param name="arg_buyer"></param> /// <param name="arg_chek_buyer_tin"></param> /// <param name="arg_start_address"></param> /// <param name="arg_end_address"></param> /// <param name="arg_driver_tin"></param> /// <param name="arg_chek_driver_tin"></param> /// <param name="arg_driver_name"></param> /// <param name="arg_transport_coast"></param> /// <param name="arg_reception_info"></param> /// <param name="arg_receiver_info"></param> /// <param name="arg_delivery_date"></param> /// <param name="arg_status"></param> /// <param name="arg_seller_un_id">unicaluri nomeri mag. LTD-s saxelmcifo saregistracio nomeri (chek_service_user => un_id)</param> /// <param name="arg_par_id"></param> /// <param name="arg_car_number"></param> /// <param name="arg_s_user_id">qve-momxmareblis ID (chek_service_user => s_user_id)</param> /// <param name="arg_begin_date"></param> /// <param name="arg_tran_cost_payer"></param> /// <param name="arg_trans_id"></param> /// <param name="arg_trans_txt"></param> /// <param name="arg_comment"></param> /// <returns></returns> public XmlElement PrepareZednadebi(Zednadebi arg_zed, int arg_id, DataProvider.OperationType arg_type, Buyer arg_buyer, int arg_chek_buyer_tin, string arg_start_address, string arg_end_address, string arg_driver_tin, int arg_chek_driver_tin, string arg_driver_name, decimal arg_transport_coast, string arg_reception_info, string arg_receiver_info, DateTime arg_delivery_date, int arg_status, int arg_seller_un_id, int arg_par_id, string arg_car_number, int arg_s_user_id, DateTime arg_begin_date, int arg_tran_cost_payer, int arg_trans_id, string arg_trans_txt, string arg_comment ) { string sxmlzed = zedtemplate; string sxmlrems = ""; //all zed remainders as <GOODS> entities decimal dRemsFullAmount = 0.0m; //remainders total cost for FULL_AMOUNT foreach (Remainder nrem in arg_zed.OrderedItemList) { dRemsFullAmount += nrem.initial_pieces * nrem.sell_price; sxmlrems += PrepareRemainder(nrem, refconn.GetProductByBarCode(nrem.product_barcode), //TODO: WHAT'S HERE? 0, 1, "idk", 1, 0); } System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("en-US"); sxmlzed = sxmlzed.Replace("{GOODS_LIST}", sxmlrems); // sxmlzed = sxmlzed.Replace("{ID}", arg_id.ToString()); sxmlzed = sxmlzed.Replace("{TYPE}", ((int)arg_type).ToString()); sxmlzed = sxmlzed.Replace("{BUYER_TIN}", arg_buyer.saidentifikacio_kodi); sxmlzed = sxmlzed.Replace("{CHEK_BUYER_TIN}", arg_chek_buyer_tin.ToString()); sxmlzed = sxmlzed.Replace("{BUYER_NAME}", arg_buyer.saxeli); sxmlzed = sxmlzed.Replace("{START_ADDRESS}", arg_start_address.ToString()); sxmlzed = sxmlzed.Replace("{END_ADDRESS}", arg_end_address.ToString()); sxmlzed = sxmlzed.Replace("{DRIVER_TIN}", arg_driver_tin.ToString()); sxmlzed = sxmlzed.Replace("{CHEK_DRIVER_TIN}", arg_chek_driver_tin.ToString()); sxmlzed = sxmlzed.Replace("{DRIVER_NAME}", arg_driver_name.ToString()); sxmlzed = sxmlzed.Replace("{TRANSPORT_COAST}", Utilities.Utilities.StringFromDecimal(Math.Round(arg_transport_coast, 3))); sxmlzed = sxmlzed.Replace("{RECEPTION_INFO}", arg_reception_info.ToString()); sxmlzed = sxmlzed.Replace("{RECEIVER_INFO}", arg_receiver_info.ToString()); string delivery_date_tag = "<DELIVERY_DATE/>"; switch (arg_status) { case 0: case 1: if (DataProvider.OperationType.SellTransporting == arg_type) { delivery_date_tag = "<DELIVERY_DATE>" + arg_delivery_date.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss" , culture) + "</DELIVERY_DATE>"; } break; case 2: delivery_date_tag = "<DELIVERY_DATE>" + arg_delivery_date.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss" , culture) + "</DELIVERY_DATE>"; break; } sxmlzed = sxmlzed.Replace("{DELIVERY_DATE_TAG}", delivery_date_tag); sxmlzed = sxmlzed.Replace("{STATUS}", arg_status.ToString()); sxmlzed = sxmlzed.Replace("{SELLER_UN_ID}", arg_seller_un_id.ToString()); sxmlzed = sxmlzed.Replace("{PAR_ID}", arg_par_id.ToString()); sxmlzed = sxmlzed.Replace("{FULL_AMOUNT}", Utilities.Utilities.StringFromDecimal(Math.Round(dRemsFullAmount))); sxmlzed = sxmlzed.Replace("{CAR_NUMBER}", arg_car_number.ToString()); sxmlzed = sxmlzed.Replace("{WAYBILL_NUMBER}", arg_zed.zednadebis_nomeri); sxmlzed = sxmlzed.Replace("{S_USER_ID}", arg_s_user_id.ToString()); sxmlzed = sxmlzed.Replace("{BEGIN_DATE}", arg_begin_date.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss", culture)); sxmlzed = sxmlzed.Replace("{TRAN_COST_PAYER}", arg_tran_cost_payer.ToString()); sxmlzed = sxmlzed.Replace("{TRANS_ID}", arg_trans_id.ToString()); sxmlzed = sxmlzed.Replace("{TRANS_TXT}", arg_trans_txt.ToString()); sxmlzed = sxmlzed.Replace("{COMMENT}", arg_comment.ToString()); XmlDocument doc = new XmlDocument(); doc.LoadXml(sxmlzed); XmlNode waybill = doc.SelectSingleNode("/WAYBILL"); return((XmlElement)waybill); }