public frm_NormalSiparisYarat(WS_Satis.ZktmobilSItemslist[] list, string pvbeln, Title title)
        {
            InitializeComponent();
            this._title = title;
            SetTitle();
            _VBELN = pvbeln;

            _dt_urun = new DataTable();
            _dt_urun.Columns.Add("MATNR");
            _dt_urun.Columns.Add("MAKTX");
            _dt_urun.Columns.Add("MENGE");
            _dt_urun.Columns.Add("MEINS");
            _dt_urun.Columns.Add("MEISC"); //Iscilik kontrolu icin...

            foreach (WS_Satis.ZktmobilSItemslist var in list)
            {
                DataRow row = _dt_urun.NewRow();
                row["MATNR"] = var.Matnr;
                row["MAKTX"] = var.Maktx;
                row["MENGE"] = var.Menge;
                row["MEINS"] = var.Meins;
                row["MEISC"] = var.Iscilik;
                _dt_urun.Rows.Add(row);
            }


            grd_Urun.DataSource = null;
            grd_Urun.DataSource = _dt_urun;

            WS_Satis.service SRV = new KoctasMobil.WS_Satis.service();
            WS_Satis.ZktmobilCalcTotalAmount         amount   = new KoctasMobil.WS_Satis.ZktmobilCalcTotalAmount();
            WS_Satis.ZktmobilCalcTotalAmountResponse response = new KoctasMobil.WS_Satis.ZktmobilCalcTotalAmountResponse();
            SRV.Url         = Utility.getWsUrl("zktmobil_satis");
            SRV.Credentials = ProgramGlobalData.g_credential;

            amount.TiList = new KoctasMobil.WS_Satis.ZktmobilItemsToCalculate[_dt_urun.Rows.Count];
            for (int i = 0; i < _dt_urun.Rows.Count; i++)
            {
                amount.TiList[i]       = new KoctasMobil.WS_Satis.ZktmobilItemsToCalculate();
                amount.TiList[i].Matnr = _dt_urun.Rows[i]["MATNR"].ToString();
                amount.TiList[i].Meins = _dt_urun.Rows[i]["MEINS"].ToString();
                amount.TiList[i].Menge = Convert.ToDecimal(_dt_urun.Rows[i]["MENGE"].ToString());
            }
            response                = SRV.ZktmobilCalcTotalAmount(amount);
            txt_toplamTutar.Text    = response.ETotal.ToString() + " TL";
            txt_IndToplamTutar.Text = response.EParoTotal.ToString() + " TL";
        }
        private void CalculateTotal()
        {
            Cursor.Current = Cursors.WaitCursor;
            WS_Satis.service SRV = new KoctasMobil.WS_Satis.service();
            WS_Satis.ZktmobilCalcTotalAmount         amount   = new KoctasMobil.WS_Satis.ZktmobilCalcTotalAmount();
            WS_Satis.ZktmobilCalcTotalAmountResponse response = new KoctasMobil.WS_Satis.ZktmobilCalcTotalAmountResponse();
            SRV.Url = Utility.getWsUrl("zktmobil_satis"); SRV.Credentials = ProgramGlobalData.g_credential;
            int i = 0;

            amount.TiList = new KoctasMobil.WS_Satis.ZktmobilItemsToCalculate[lst_items.Items.Count];
            foreach (ListViewItem item in lst_items.Items)
            {
                amount.TiList[i]       = new KoctasMobil.WS_Satis.ZktmobilItemsToCalculate();
                amount.TiList[i].Matnr = item.Text;
                amount.TiList[i].Menge = Convert.ToDecimal(item.SubItems[2].Text);
                i++;
            }
            response             = SRV.ZktmobilCalcTotalAmount(amount);
            txt_toplamTutar.Text = response.ETotal.ToString() + " TL";
            Cursor.Current       = Cursors.Default;
        }
        private void btn_Sil_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                if (grd_Urun.CurrentRowIndex >= 0)
                {
                    _dt_urun.Rows.RemoveAt(grd_Urun.CurrentRowIndex);
                    grd_Urun.DataSource = null;
                    grd_Urun.DataSource = _dt_urun;
                }

                Cursor.Current = Cursors.WaitCursor;
                WS_Satis.service SRV = new KoctasMobil.WS_Satis.service();
                SRV.Url         = Utility.getWsUrl("zktmobil_satis");
                SRV.Credentials = ProgramGlobalData.g_credential;
                WS_Satis.ZktmobilCalcTotalAmount         amount   = new KoctasMobil.WS_Satis.ZktmobilCalcTotalAmount();
                WS_Satis.ZktmobilCalcTotalAmountResponse response = new KoctasMobil.WS_Satis.ZktmobilCalcTotalAmountResponse();
                amount.TiList = new KoctasMobil.WS_Satis.ZktmobilItemsToCalculate[_dt_urun.Rows.Count];
                for (int i = 0; i < _dt_urun.Rows.Count; i++)
                {
                    amount.TiList[i]       = new KoctasMobil.WS_Satis.ZktmobilItemsToCalculate();
                    amount.TiList[i].Matnr = _dt_urun.Rows[i]["MATNR"].ToString();
                    amount.TiList[i].Meins = _dt_urun.Rows[i]["MEINS"].ToString();
                    amount.TiList[i].Menge = Convert.ToDecimal(_dt_urun.Rows[i]["MENGE"].ToString());
                }
                response                = SRV.ZktmobilCalcTotalAmount(amount);
                txt_toplamTutar.Text    = response.ETotal.ToString() + " TL";
                txt_IndToplamTutar.Text = response.EParoTotal.ToString() + " TL";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "HATA!", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
        private void btn_ekle_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txt_maktx.Text))
            {
                if (!string.IsNullOrEmpty(txt_Barkod.Text))
                {
                    txt_Barkod_KeyPress(btn_Ekle, new KeyPressEventArgs((char)13));
                }
                else if (!string.IsNullOrEmpty(txt_matnr.Text))
                {
                    txt_matnr_KeyPress(btn_Ekle, new KeyPressEventArgs((char)13));
                }
            }
            if (String.IsNullOrEmpty(txt_maktx.Text))
            {
                return;
            }

            try
            {
                decimal.Parse(txt_miktar.Text.Trim());
            }
            catch
            {
                MessageBox.Show("Miktar alanına yalnız sayısal değer girebilirsiniz.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            WS_Satis.service SRV = new KoctasMobil.WS_Satis.service();
            WS_Satis.ZktmobilCalcTotalAmount         amount   = new KoctasMobil.WS_Satis.ZktmobilCalcTotalAmount();
            WS_Satis.ZktmobilCalcTotalAmountResponse response = new KoctasMobil.WS_Satis.ZktmobilCalcTotalAmountResponse();
            WS_Satis.ZktmobilAddItem         add         = new KoctasMobil.WS_Satis.ZktmobilAddItem();
            WS_Satis.ZktmobilAddItemResponse addresponse = new KoctasMobil.WS_Satis.ZktmobilAddItemResponse();
            SRV.Url         = Utility.getWsUrl("zktmobil_satis");
            SRV.Credentials = ProgramGlobalData.g_credential;
            try
            {
                bool    ekle   = true;
                decimal toplam = 0m;
                for (int j = 0; j < _dt_urun.Rows.Count; j++)
                {
                    if (_dt_urun.Rows[j]["MATNR"].ToString() == txt_matnr.Text.Trim())
                    {
                        ekle    = false;
                        toplam += Convert.ToDecimal(_dt_urun.Rows[j]["MENGE"].ToString());
                    }
                }
                toplam += Convert.ToDecimal(txt_miktar.Text.Trim());

                add.IFOzel           = this._transferli; //transferli
                add.IEan             = txt_Barkod.Text.Trim();
                add.IMatkl           = matkl;
                add.IMtart           = mtart;
                add.IMatnr           = txt_matnr.Text.Trim();
                add.IMenge           = decimal.Parse(toplam.ToString());
                add.IMengeSpecified  = true;
                add.IMeins           = txt_birim.Text.Trim();
                addresponse.TeReturn = new KoctasMobil.WS_Satis.ZkmobilReturn[1];
                add.TeReturn         = new KoctasMobil.WS_Satis.ZkmobilReturn[1];
                addresponse          = SRV.ZktmobilAddItem(add);


                if (addresponse.TeReturn[0].RcCode.ToUpper() != "S")
                {
                    throw(new Exception(addresponse.TeReturn[0].RcText));
                }


                for (int j = 0; j < _dt_urun.Rows.Count; j++)
                {
                    if (_dt_urun.Rows[j]["MATNR"].ToString() == txt_matnr.Text.Trim())
                    {
                        _dt_urun.Rows[j]["MENGE"] = Convert.ToDecimal(_dt_urun.Rows[j]["MENGE"].ToString()) + Convert.ToDecimal(txt_miktar.Text.Trim());
                    }
                }
                if (ekle)
                {
                    DataRow row = _dt_urun.NewRow();
                    row["MATNR"] = txt_matnr.Text.Trim();
                    row["MAKTX"] = txt_maktx.Text.Trim();
                    row["MENGE"] = txt_miktar.Text.Trim();
                    row["MEINS"] = txt_birim.Text.Trim();
                    _dt_urun.Rows.Add(row);
                }
                grd_Urun.DataSource = null;
                grd_Urun.DataSource = _dt_urun;

                amount.TiList = new KoctasMobil.WS_Satis.ZktmobilItemsToCalculate[_dt_urun.Rows.Count];
                for (int i = 0; i < _dt_urun.Rows.Count; i++)
                {
                    amount.TiList[i]       = new KoctasMobil.WS_Satis.ZktmobilItemsToCalculate();
                    amount.TiList[i].Matnr = _dt_urun.Rows[i]["MATNR"].ToString();
                    amount.TiList[i].Meins = _dt_urun.Rows[i]["MEINS"].ToString();
                    amount.TiList[i].Menge = Convert.ToDecimal(_dt_urun.Rows[i]["MENGE"].ToString());
                }
                response                = SRV.ZktmobilCalcTotalAmount(amount);
                txt_toplamTutar.Text    = response.ETotal.ToString() + " TL";
                txt_IndToplamTutar.Text = response.EParoTotal.ToString() + " TL";
                txt_birim.Text          = string.Empty;
                txt_maktx.Text          = string.Empty;
                txt_matnr.Text          = string.Empty;
                txt_Barkod.Text         = string.Empty;
                txt_miktar.Text         = string.Empty;
                txt_miktar.Enabled      = false;
                txt_Barkod.Focus();
            }
            catch (Exception ex)
            {
                txt_miktar.Focus();
                MessageBox.Show(ex.Message, "HATA!", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
        private void btn_ekle_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txt_maktx.Text))
            {
                if (!string.IsNullOrEmpty(txt_Barkod.Text))
                {
                    txt_Barkod_KeyPress(btn_Ekle, new KeyPressEventArgs((char)13));
                }
                else if (!string.IsNullOrEmpty(txt_matnr.Text))
                {
                    txt_matnr_KeyPress(btn_Ekle, new KeyPressEventArgs((char)13));
                }
            }
            if (String.IsNullOrEmpty(txt_maktx.Text))
            {
                return;
            }

            try
            {
                decimal.Parse(txt_miktar.Text.Trim());
            }
            catch
            {
                MessageBox.Show("Miktar alanına yalnız sayısal değer girebilirsiniz.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            WS_Satis.service SRV = new KoctasMobil.WS_Satis.service();
            WS_Satis.ZktmobilCalcTotalAmount         amount   = new KoctasMobil.WS_Satis.ZktmobilCalcTotalAmount();
            WS_Satis.ZktmobilCalcTotalAmountResponse response = new KoctasMobil.WS_Satis.ZktmobilCalcTotalAmountResponse();
            SRV.Url         = Utility.getWsUrl("zktmobil_satis");
            SRV.Credentials = ProgramGlobalData.g_credential;
            try
            {
                bool    ekle   = true;
                decimal toplam = 0m;
                for (int j = 0; j < _dt_urun.Rows.Count; j++)
                {
                    if (_dt_urun.Rows[j]["MATNR"].ToString() == txt_matnr.Text.Trim())
                    {
                        ekle    = false;
                        toplam += Convert.ToDecimal(_dt_urun.Rows[j]["MENGE"].ToString());
                    }
                }
                toplam += Convert.ToDecimal(txt_miktar.Text.Trim());

                for (int j = 0; j < _dt_urun.Rows.Count; j++)
                {
                    if (_dt_urun.Rows[j]["MATNR"].ToString() == txt_matnr.Text.Trim())
                    {
                        _dt_urun.Rows[j]["MENGE"] = Convert.ToDecimal(_dt_urun.Rows[j]["MENGE"].ToString()) + Convert.ToDecimal(txt_miktar.Text.Trim());
                    }
                }
                if (ekle)
                {
                    DataRow row = _dt_urun.NewRow();
                    row["MATNR"] = txt_matnr.Text.Trim();
                    row["MAKTX"] = txt_maktx.Text.Trim();
                    row["MENGE"] = txt_miktar.Text.Trim();
                    row["MEINS"] = txt_birim.Text.Trim();
                    if (rdb_Raf.Checked)
                    {
                        row["IADE"] = "R";
                    }
                    if (rdb_Sarf.Checked)
                    {
                        row["IADE"] = "S";
                    }
                    if (rdb_Tedarikci.Checked)
                    {
                        row["IADE"] = "T";
                    }
                    _dt_urun.Rows.Add(row);
                }
                grd_Urun.DataSource = null;
                grd_Urun.DataSource = _dt_urun;


                amount.TiList = new KoctasMobil.WS_Satis.ZktmobilItemsToCalculate[_dt_urun.Rows.Count];
                for (int i = 0; i < _dt_urun.Rows.Count; i++)
                {
                    amount.TiList[i]       = new KoctasMobil.WS_Satis.ZktmobilItemsToCalculate();
                    amount.TiList[i].Matnr = _dt_urun.Rows[i]["MATNR"].ToString();
                    amount.TiList[i].Meins = _dt_urun.Rows[i]["MEINS"].ToString();
                    amount.TiList[i].Menge = Convert.ToDecimal(_dt_urun.Rows[i]["MENGE"].ToString());
                }
                response             = SRV.ZktmobilCalcTotalAmount(amount);
                txt_toplamTutar.Text = response.ETotal.ToString() + " TL";
                txt_birim.Text       = string.Empty;
                txt_maktx.Text       = string.Empty;
                txt_matnr.Text       = string.Empty;
                txt_Barkod.Text      = string.Empty;
                txt_miktar.Text      = string.Empty;
                txt_Barkod.Focus();
            }
            catch (Exception ex)
            {
                txt_miktar.Focus();
                MessageBox.Show(ex.Message, "HATA!", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }