Exemple #1
0
        private void cmdADD_Click(object sender, EventArgs e)
        {
            try
            {
                switch (selectedGrid)
                {
                case enumSelectedGrid.HeaderSelected:
                    //if (DateTime.Today <= GlobalVar.LastClosingDate)
                    //{
                    //    throw new Exception(String.Format(Messages.Error.AlreadyClosingPJT, GlobalVar.LastClosingDate));
                    //}
                    Penjualan.frmMPRUpdate ifrmChild = new Penjualan.frmMPRUpdate(this);
                    Program.MainForm.RegisterChild(ifrmChild);
                    ifrmChild.ShowDialog();
                    break;

                case enumSelectedGrid.DetailSelected:
                    if (dataGridHeader.SelectedCells.Count == 0)
                    {
                        MessageBox.Show(Messages.Error.RowNotSelected);
                        return;
                    }
                    if (dataGridHeader.SelectedCells[0].OwningRow.Cells["TglGudang"].Value.ToString() != "")
                    {
                        MessageBox.Show("Sudah dibuat nota retur. Tidak bisa tambah...!!!");
                        return;
                    }
                    //if ((DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglMPR"].Value <= GlobalVar.LastClosingDate)
                    //{
                    //    throw new Exception(String.Format(Messages.Error.AlreadyClosingPJT, GlobalVar.LastClosingDate));
                    //}

                    Guid _headerID = (Guid)dataGridHeader.SelectedCells[0].OwningRow.Cells["HeaderRowID"].Value;
                    Penjualan.frmMPRDetailUpdate ifrmChild2 = new Penjualan.frmMPRDetailUpdate(this, _headerID, frmMPRDetailUpdate.enumFormMode.New);
                    Program.MainForm.RegisterChild(ifrmChild2);
                    ifrmChild2.ShowDialog();

                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }
Exemple #2
0
        private void cmdEDIT_Click(object sender, EventArgs e)
        {
            Guid _rowID;

            try
            {
                switch (selectedGrid)
                {
                case enumSelectedGrid.HeaderSelected:
                    if (dataGridHeader.SelectedCells.Count == 0)
                    {
                        MessageBox.Show(Messages.Error.RowNotSelected);
                        return;
                    }
                    if (dataGridHeader.SelectedCells[0].OwningRow.Cells["TglGudang"].Value.ToString() != "")
                    {
                        MessageBox.Show("Sudah dibuat nota retur. Tidak bisa di edit...!!!");
                        return;
                    }
                    GlobalVar.LastClosingDate = (DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglMPR"].Value;
                    if ((DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglMPR"].Value <= GlobalVar.LastClosingDate)
                    {
                        throw new Exception(String.Format(Messages.Error.AlreadyClosingPJT, GlobalVar.LastClosingDate));
                    }

                    _rowID = (Guid)dataGridHeader.SelectedCells[0].OwningRow.Cells["HeaderRowID"].Value;
                    Penjualan.frmMPRUpdate ifrmChild = new Penjualan.frmMPRUpdate(this, _rowID);
                    ifrmChild.ShowDialog();

                    break;

                case enumSelectedGrid.DetailSelected:
                    //if (dataGridDetail.SelectedCells.Count == 0)
                    //{
                    //    MessageBox.Show(Messages.Error.RowNotSelected);
                    //    return;
                    //}
                    //if (dataGridHeader.SelectedCells[0].OwningRow.Cells["TglGudang"].Value.ToString() != "")
                    //{
                    //    MessageBox.Show("Sudah dibuat nota retur. Tidak bisa di edit...!!!");
                    //    return;
                    //}

                    //string kodeRetur = dataGridDetail.SelectedCells[0].OwningRow.Cells["KodeRetur"].Value.ToString().Trim();
                    //if (kodeRetur == "1" )
                    //{

                    /* Note:
                     * /* Bila jarak tgl terima dan tgl memo
                     * belum 60 hari (!CekACCRetur())
                     * maka tidak diperlukan No ACC untuk prosess nota */
                    //if (!CekACCRetur())
                    //{
                    //    MessageBox.Show("Tidak butuh ACC untuk proses nota retur");
                    //    return;
                    //}

                    //    }

                    //    //GlobalVar.LastClosingDate = (DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglMPR"].Value;
                    //    //if ((DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglMPR"].Value <= GlobalVar.LastClosingDate)
                    //    //{
                    //    //    throw new Exception(String.Format(Messages.Error.AlreadyClosingPJT, GlobalVar.LastClosingDate));
                    //    //}

                    //_rowID = (Guid)dataGridDetail.SelectedCells[0].OwningRow.Cells["DetailRowID"].Value;
                    //Penjualan.frmMPRDetailUpdate ifrmChild2 = new Penjualan.frmMPRDetailUpdate(this, _rowID, frmMPRDetailUpdate.enumFormMode.Update);
                    //ifrmChild2.ShowDialog();

                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }