Exemple #1
0
        private void GetDialogResultCetakAmplop(frmCetakAmplop dialogForm)
        {
            string shift, bayar;

            shift = dialogForm.Shift;
            bayar = dialogForm.Bayar;

            string   kodeToko = dataGridView1.SelectedCells[0].OwningRow.Cells["KodeToko"].Value.ToString();
            string   expedisi = dataGridView1.SelectedCells[0].OwningRow.Cells["Expedisi"].Value.ToString();
            DateTime tgl0     = dateTextBox1.DateValue.Value;
            DateTime tgl      = txtTgl.DateValue.Value;

            try
            {
                this.Cursor = Cursors.WaitCursor;
                DataTable dt = new DataTable();
                using (Database db = new Database())
                {
                    db.Commands.Add(db.CreateCommand("rsp_CetakPackingList"));
                    db.Commands[0].Parameters.Add(new Parameter("@kodeToko", SqlDbType.VarChar, kodeToko));
                    db.Commands[0].Parameters.Add(new Parameter("@expedisi", SqlDbType.VarChar, expedisi));
                    db.Commands[0].Parameters.Add(new Parameter("@date", SqlDbType.DateTime, tgl));
                    db.Commands[0].Parameters.Add(new Parameter("@date0", SqlDbType.DateTime, tgl0));
                    db.Commands[0].Parameters.Add(new Parameter("@bayar", SqlDbType.VarChar, bayar));
                    db.Commands[0].Parameters.Add(new Parameter("@shift", SqlDbType.VarChar, shift));
                    dt = db.Commands[0].ExecuteDataTable();
                }
                if (dt.Rows.Count > 0)
                {
                    CetakPackingListAmplop(dt);
                }
                else
                {
                    MessageBox.Show("Tidak ada data packing list");
                }
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Exemple #2
0
 private void frmPackingListBrowse_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F3)
     {
         if (!SecurityManager.IsAuditor())
         {
             if (dataGridView1.SelectedCells.Count == 0)
             {
                 MessageBox.Show(Messages.Error.RowNotSelected);
             }
             if (dataGridView1.SelectedCells.Count > 0)
             {
                 string kodeToko = dataGridView1.SelectedCells[0].OwningRow.Cells["KodeToko"].Value.ToString();
                 string expedisi = dataGridView1.SelectedCells[0].OwningRow.Cells["Expedisi"].Value.ToString();
                 // DateTime tgl = DateTime.Parse(dataGridView1.SelectedCells[0].OwningRow.Cells["TglSJ"].Value.ToString());
                 Guid     rowID = (Guid)dataGridView1.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                 DateTime tgl0  = dateTextBox1.DateValue.Value;
                 DateTime tgl   = txtTgl.DateValue.Value;
                 XPDC.frmCetakPackingList ifrmChild = new ISA.Trading.XPDC.frmCetakPackingList(this, kodeToko, expedisi, tgl0, tgl, rowID);
                 ifrmChild.MdiParent = Program.MainForm;
                 Program.MainForm.RegisterChild(ifrmChild);
                 ifrmChild.Show();
             }
         }
     }
     else if (e.KeyCode == Keys.F4)
     {
         if (!SecurityManager.IsAuditor())
         {
             if (dataGridView1.SelectedCells.Count == 0)
             {
                 MessageBox.Show(Messages.Error.RowNotSelected);
             }
             frmCetakAmplop ifrmDialog = new frmCetakAmplop();
             ifrmDialog.ShowDialog();
             if (ifrmDialog.DialogResult == DialogResult.OK)
             {
                 GetDialogResultCetakAmplop(ifrmDialog);
             }
         }
     }
 }