private void StokKarti_Load(object sender, EventArgs e) { PASIF_MI.SelectedIndex = 0; RefreshGrid(); STOK_TIPI.SQLText = "SELECT TIP_TANIMI, TIP_KODU FROM TBLSTOKTIP WHERE TEDARIKCI_KODU = '" + Goto724Lib.tedarikciKodu + "'"; STOK_TIPI.Open(); STOK_KATEGORI.Open(); grdStokOran.Rows.Add(0, 0, 0, 0, 0, 0, 0, 0); grdStokFiyat.Rows.Add("Fiyat 1", 0, 0); grdStokFiyat.Rows.Add("Fiyat 2", 0, 0); grdStokFiyat.Rows.Add("Fiyat 3", 0, 0); grdStokFiyat.Rows.Add("Fiyat 4", 0, 0); grdStokFiyat.Rows.Add("Fiyat 5", 0, 0); grdStokFiyat.Rows.Add("Fiyat 6", 0, 0); grdStokFiyat.Rows.Add("Fiyat 7", 0, 0); }
private void ScreenFill(WebService service) { STOK_KOD.Text = service.GetString("STOK_KODU"); STOK_AD.Text = service.GetString("STOK_ADI"); STOK_TIPI.SetString(service.GetString("STOK_TIPI")); STOK_KATEGORI.SetString(service.GetString("KATEGORI_KODU")); ACIKLAMA1.Text = service.GetString("ACIKLAMA_1"); ACIKLAMA2.Text = service.GetString("ACIKLAMA_2"); ACIKLAMA3.Text = service.GetString("ACIKLAMA_3"); if (service.GetDouble("SATIS_FIYAT1") != -1) { SATIS_FIYAT1.Text = service.GetDouble("SATIS_FIYAT1").ToString(); } if (service.GetDouble("ALIS_FIYAT1") != -1) { ALIS_FIYAT1.Text = service.GetDouble("ALIS_FIYAT1").ToString(); } SATIS_FIYAT1_Leave(SATIS_FIYAT1, null); //ALIS_FIYAT1.Text = service.GetString("ALIS_FIYAT1"); if (grdStokOran.Visible) { grdStokOran.Rows[0].Cells["grdEt"].Value = service.GetDouble("ET_ORAN", 0); grdStokOran.Rows[0].Cells["grdKiyma"].Value = service.GetDouble("KIYMA_ORAN", 0); grdStokOran.Rows[0].Cells["grdDana"].Value = service.GetDouble("DANA_ORAN", 0); grdStokOran.Rows[0].Cells["grdSutDana"].Value = service.GetDouble("SUT_DANA_ORAN", 0); grdStokOran.Rows[0].Cells["grdHindi"].Value = service.GetDouble("HINDI_ORAN", 0); grdStokOran.Rows[0].Cells["grdTavuk"].Value = service.GetDouble("TAVUK_ORAN", 0); grdStokOran.Rows[0].Cells["grdYag"].Value = service.GetDouble("YAG_ORAN", 0); grdStokOran.Rows[0].Cells["grdBaharat"].Value = service.GetDouble("BAHARAT_ORAN", 0); } for (int i = 0; i < grdStokFiyat.Rows.Count; i++) { if (service.GetString("SATIS_FIYAT" + (i + 2)) != "") { grdStokFiyat.Rows[i].Cells["grdFiyat"].Value = service.GetDouble("SATIS_FIYAT" + (i + 2)); } else { grdStokFiyat.Rows[i].Cells["grdFiyat"].Value = 0; } } if (service.GetString("PASIF_MI") == "H") { PASIF_MI.SelectedIndex = 0; } else { PASIF_MI.SelectedIndex = 1; } if (service.tags.Contains("STOK_RESIM") && service.GetString("STOK_RESIM") != "") { STOK_RESIM.Image = service.GetImage("STOK_RESIM"); //Goto724Lib.Base64ToImage(service.GetString("STOK_RESIM")); } else { STOK_RESIM.Image = Goto724Lib.noImage; } GrdStokIskDuzenle(); GrdStokOranDuzenle(); }
private void btnKaydet_Click(object sender, EventArgs e) { if (STOK_KOD.Text != "" && STOK_AD.Text != "" && STOK_KATEGORI.Text != "" && STOK_TIPI.Text != "") { WebService kntlService = new WebService(); kntlService.SQLText = "SELECT STOK_KODU FROM TBLSTOK WHERE STOK_KODU = '" + STOK_KOD.Text + "' AND TEDARIKCI_KODU = '" + Goto724Lib.tedarikciKodu + "'"; kntlService.Open(); if (kntlService.DataCount() > 0) { string image = ""; if (imageChanged && !Goto724Lib.isNoImage(STOK_RESIM.Image)) { image = Goto724Lib.ByteArrayToString(Goto724Lib.ImageToByteArray(STOK_RESIM.Image)); } string updStr = "UPDATE TBLSTOK SET STOK_ADI = '" + STOK_AD.Text + "', TEDARIKCI_KODU = '" + Goto724Lib.tedarikciKodu + "'"; if (image != "") { updStr += ", STOK_RESIM = 0x" + image; } if (STOK_TIPI.GetString() != "") { updStr += ", STOK_TIPI = '" + STOK_TIPI.GetString() + "'"; } else { updStr += ", STOK_TIPI = NULL"; } if (STOK_KATEGORI.GetString() != "") { updStr += ", KATEGORI_KODU = '" + STOK_KATEGORI.GetString() + "'"; } else { updStr += ", KATEGORI_KODU = NULL"; } if (ACIKLAMA1.Text != "") { updStr += ", ACIKLAMA_1 = '" + ACIKLAMA1.Text + "'"; } else { updStr += ", ACIKLAMA_1 = NULL"; } if (ACIKLAMA2.Text != "") { updStr += ", ACIKLAMA_2 = '" + ACIKLAMA2.Text + "'"; } else { updStr += ", ACIKLAMA_2 = NULL"; } if (ACIKLAMA3.Text != "") { updStr += ", ACIKLAMA_3 = '" + ACIKLAMA3.Text + "'"; } else { updStr += ", ACIKLAMA_3 = NULL"; } if (ALIS_FIYAT1.Text != "") { updStr += ", ALIS_FIYAT1 = " + Goto724Lib.RemoveChar(ALIS_FIYAT1.Text, '.').Replace(',', '.') + ""; } else { updStr += ", ALIS_FIYAT1 = NULL"; } if (SATIS_FIYAT1.Text != "") { updStr += ", SATIS_FIYAT1 = " + Goto724Lib.RemoveChar(SATIS_FIYAT1.Text, '.').Replace(',', '.') + ""; } else { updStr += ", SATIS_FIYAT1 = NULL"; } for (int i = 0; i < grdStokFiyat.Rows.Count; i++) { if (grdStokFiyat.Rows[i].Cells["grdFiyat"].Value != null) { updStr += ", SATIS_FIYAT" + (i + 2) + " = " + Goto724Lib.RemoveChar(grdStokFiyat.Rows[i].Cells["grdFiyat"].Value.ToString(), '.').Replace(',', '.'); } else { updStr += ", SATIS_FIYAT" + (i + 2) + " = 0"; } } //if (ALIS_FIYAT1.Text != "") updStr += ", ALIS_FIYAT1 = '" + ALIS_FIYAT1.Text + "'"; //else updStr += ", ALIS_FIYAT1 = NULL"; if (PASIF_MI.SelectedIndex == -1 || PASIF_MI.SelectedIndex == 0) { updStr += ", PASIF_MI = 'H'"; } else { updStr += ", PASIF_MI = 'E'"; } if (STOK_KATEGORI.Text == "Döner Kebap") { if (grdStokOran.Rows[0].Cells["grdEt"].Value == null) { updStr += ", ET_ORAN = 0"; } else { updStr += ", ET_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdEt"].Value) * 100).ToString().Replace(',', '.'); } if (grdStokOran.Rows[0].Cells["grdKiyma"].Value == null) { updStr += ", KIYMA_ORAN = 0"; } else { updStr += ", KIYMA_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdKiyma"].Value) * 100).ToString().Replace(',', '.'); } if (grdStokOran.Rows[0].Cells["grdDana"].Value == null) { updStr += ", DANA_ORAN = 0"; } else { updStr += ", DANA_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdDana"].Value) * 100).ToString().Replace(',', '.'); } if (grdStokOran.Rows[0].Cells["grdSutDana"].Value == null) { updStr += ", SUT_DANA_ORAN = 0"; } else { updStr += ", SUT_DANA_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdSutDana"].Value) * 100).ToString().Replace(',', '.'); } if (grdStokOran.Rows[0].Cells["grdHindi"].Value == null) { updStr += ", HINDI_ORAN = 0"; } else { updStr += ", HINDI_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdHindi"].Value) * 100).ToString().Replace(',', '.'); } if (grdStokOran.Rows[0].Cells["grdTavuk"].Value == null) { updStr += ", TAVUK_ORAN = 0"; } else { updStr += ", TAVUK_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdTavuk"].Value) * 100).ToString().Replace(',', '.'); } if (grdStokOran.Rows[0].Cells["grdYag"].Value == null) { updStr += ", YAG_ORAN = 0"; } else { updStr += ", YAG_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdYag"].Value) * 100).ToString().Replace(',', '.'); } if (grdStokOran.Rows[0].Cells["grdBaharat"].Value == null) { updStr += ", BAHARAT_ORAN = 0"; } else { updStr += ", BAHARAT_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdBaharat"].Value) * 100).ToString().Replace(',', '.'); } } updStr += " WHERE STOK_KODU = '" + STOK_KOD.Text + "' AND TEDARIKCI_KODU = '" + Goto724Lib.tedarikciKodu + "'"; WebService service = new WebService(); service.SQLText = updStr; service.Open(); if (service.errorCode == "0") { GotoMessage.ShowMessage("Bilgi", "Kayıt Düzenleme Tamamlandı"); PanelClear(); RefreshGrid(); } else { GotoMessage.ShowMessage("Hata", "Kayıt Aktarılırken Hatayla Karşılaşıldı.\nHata: " + service.description); } } else { string image = ""; if (imageChanged && !Goto724Lib.isNoImage(STOK_RESIM.Image)) { image = Goto724Lib.ByteArrayToString(Goto724Lib.ImageToByteArray(STOK_RESIM.Image)); } string insStr = "INSERT INTO TBLSTOK(STOK_KODU, STOK_ADI, TEDARIKCI_KODU, STOK_TIPI, KATEGORI_KODU, ACIKLAMA_1, ACIKLAMA_2, ACIKLAMA_3, ALIS_FIYAT1, SATIS_FIYAT1, ET_ORAN, KIYMA_ORAN, DANA_ORAN, SUT_DANA_ORAN, HINDI_ORAN, TAVUK_ORAN, YAG_ORAN, BAHARAT_ORAN, SATIS_FIYAT2, SATIS_FIYAT3, SATIS_FIYAT4, SATIS_FIYAT5, SATIS_FIYAT6, SATIS_FIYAT7, SATIS_FIYAT8, PASIF_MI"; if (image != "") { insStr += ", STOK_RESIM) "; } else { insStr += ")"; } insStr += "VALUES ('" + STOK_KOD.Text + "', '" + STOK_AD.Text + "', '" + Goto724Lib.tedarikciKodu + "'"; if (STOK_TIPI.GetString() != "") { insStr += ", '" + STOK_TIPI.GetString() + "'"; } else { insStr += ", NULL"; } if (STOK_KATEGORI.GetString() != "") { insStr += ", '" + STOK_KATEGORI.GetString() + "'"; } else { insStr += ", NULL"; } if (ACIKLAMA1.Text != "") { insStr += ", '" + ACIKLAMA1.Text + "'"; } else { insStr += ", NULL"; } if (ACIKLAMA2.Text != "") { insStr += ", '" + ACIKLAMA2.Text + "'"; } else { insStr += ", NULL"; } if (ACIKLAMA3.Text != "") { insStr += ", '" + ACIKLAMA3.Text + "'"; } else { insStr += ", NULL"; } if (ALIS_FIYAT1.Text != "") { insStr += ", '" + Goto724Lib.RemoveChar(ALIS_FIYAT1.Text, '.').Replace(',', '.') + "'"; } else { insStr += ", NULL"; } if (SATIS_FIYAT1.Text != "") { insStr += ", '" + Goto724Lib.RemoveChar(SATIS_FIYAT1.Text, '.').Replace(',', '.') + "'"; } else { insStr += ", NULL"; } if (STOK_KATEGORI.Text == "Döner Kebap") { if (grdStokOran.Rows[0].Cells["grdEt"].Value == null) { insStr += ", 0"; } else { insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdEt"].Value) * 100).ToString().Replace(',', '.'); } if (grdStokOran.Rows[0].Cells["grdKiyma"].Value == null) { insStr += ", 0"; } else { insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdKiyma"].Value) * 100).ToString().Replace(',', '.'); } if (grdStokOran.Rows[0].Cells["grdDana"].Value == null) { insStr += ", 0"; } else { insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdDana"].Value) * 100).ToString().Replace(',', '.'); } if (grdStokOran.Rows[0].Cells["grdSutDana"].Value == null) { insStr += ", 0"; } else { insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdSutDana"].Value) * 100).ToString().Replace(',', '.'); } if (grdStokOran.Rows[0].Cells["grdHindi"].Value == null) { insStr += ", 0"; } else { insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdHindi"].Value) * 100).ToString().Replace(',', '.'); } if (grdStokOran.Rows[0].Cells["grdTavuk"].Value == null) { insStr += ", 0"; } else { insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdTavuk"].Value) * 100).ToString().Replace(',', '.'); } if (grdStokOran.Rows[0].Cells["grdYag"].Value == null) { insStr += ", 0"; } else { insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdYag"].Value) * 100).ToString().Replace(',', '.'); } if (grdStokOran.Rows[0].Cells["grdBaharat"].Value == null) { insStr += ", 0"; } else { insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdBaharat"].Value) * 100).ToString().Replace(',', '.'); } } else { insStr += ",0,0,0,0,0,0,0,0"; } for (int i = 0; i < grdStokFiyat.Rows.Count; i++) { if (grdStokFiyat.Rows[i].Cells["grdFiyat"].Value != null) { insStr += ", " + Goto724Lib.RemoveChar(grdStokFiyat.Rows[i].Cells["grdFiyat"].Value.ToString(), '.').Replace(',', '.'); } else { insStr += ", 0"; } } if (PASIF_MI.SelectedIndex == -1 || PASIF_MI.SelectedIndex == 0) { insStr += ", 'H'"; } else { insStr += ", 'E'"; } if (image != "") { insStr += ", 0x" + image; } insStr += ")"; WebService service = new WebService(); service.SQLText = insStr; service.Open(); if (service.errorCode == "0") { if (STOK_KATEGORI.Text == "Döner Kebap") { for (int i = 0; i < 20; i++) { WebService paketService = new WebService(); paketService.SQLText = "INSERT INTO TBLSTOKPAKET(PAKET_KODU, STOK_KODU, BIRIM_KODU, TEDARIKCI_KODU, MIKTAR, ACIKLAMA)" + "VALUES('" + STOK_KOD.Text + "" + (i + 1).ToString("000") + "', '" + STOK_KOD.Text + "', 'KG', '" + Goto724Lib.tedarikciKodu + "', " + ((i + 1) * 5) + ", '" + ((i + 1) * 5) + " Kg" + "')"; paketService.Open(); } } GotoMessage.ShowMessage("Bilgi", "Kayıt Başarıyla Tamamlandı"); PanelClear(); RefreshGrid(); } else { GotoMessage.ShowMessage("Hata", "Kayıt Aktarılırken Hatayla Karşılaşıldı.\nHata: " + service.description); } } } else { string mesaj = ""; if (STOK_KOD.Text == "") { mesaj = "Stok Kodu"; } else if (STOK_AD.Text == "") { mesaj = "Stok Adı"; } else if (STOK_KATEGORI.Text == "") { mesaj = "Kategori"; } else if (STOK_TIPI.Text == "") { mesaj = "Stok Tipi"; } mesaj += " Boş Olamaz!!"; GotoMessage.ShowMessage("Bilgi", mesaj); } }