Пример #1
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            bool isCashAllowed = LookupInfoValue.CekIndenTunai();

            if (cbSOinden.Checked == true)
            {
                if (RowIDOrderPenjualan == Guid.Empty)
                {
                    MessageBox.Show("SO/DO belum dipilih");
                    lookupSO1.Focus();
                    return;
                }
            }
            else
            {
                RowIDOrderPenjualan = Guid.Empty;
            }

            if (!isCashAllowed)
            {
                if (!_isFromPiutang)
                {
                    if (cbCara.Text == "CASH")
                    {
                        MessageBox.Show("Input Cash dari Menu Penerimaan Tunai", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
            }

            if (mode != "Edit")
            {
                if (!ValidateInput())
                {
                    return;
                }

                cara = cbCara.Text;
                if (cara == "CASH")
                {
                    cara   = "";
                    RpCash = tbNominal.Text;
                    ket    = tbKet.Text;
                }
                else if (cara == "TRN")
                {
                    /*cegatan Transfer hanya untuk biaya operasional*/
                    if (GlobalVar.Gudang != "2803")
                    {
                        string cBankTujuan = lookupBankTujuan.BankID;
                        try
                        {
                            this.Cursor = Cursors.WaitCursor;
                            DataTable dtb = new DataTable(GlobalVar.DBName);
                            using (Database db = new Database(GlobalVar.DBName))
                            {
                                db.Commands.Add(db.CreateCommand("usp_BankTujuan_LIST"));
                                db.Commands[0].Parameters.Add(new Parameter("@bankID", SqlDbType.VarChar, cBankTujuan));
                                db.Commands[0].Parameters.Add(new Parameter("@NamaAccount", SqlDbType.VarChar, "BANK OPERASIONAL"));
                                dtb = db.Commands[0].ExecuteDataTable();
                            }
                            if (dtb.Rows.Count == 0)
                            {
                                MessageBox.Show("Transfer Bank hanya digunakan untuk biaya Operasional");
                                return;
                            }
                        }
                        catch (Exception ex)
                        {
                            Error.LogError(ex);
                        }
                        finally
                        {
                            this.Cursor = Cursors.Default;
                        }
                    }
                    /*end cegatan-----------------------------------------*/

                    cara            = "T";
                    RpTrn           = tbNominal.Text;
                    ket             = tbKet.Text;
                    bankID          = lookupBankTujuan.BankID;
                    NamaBank        = lookupBankAsal1.NamaBank;
                    Lokasi          = lookupBankAsal1.Lokasi;
                    noAcc           = lookupAccountToko1.NoAccount;
                    tglRK           = (DateTime)tbTglRK.DateValue;
                    rowIDBankTujuan = lookupBankTujuan.RowID;
                }
                else if (cara == "GIRO")
                {
                    RpGiro    = tbNominal.Text;
                    ket       = tbKet.Text;
                    NamaBank  = lookupBankAsal1.NamaBank;
                    Lokasi    = lookupBankAsal1.Lokasi;
                    noAcc     = lookupAccountToko1.NoAccount;
                    tglGiro   = (DateTime)tbTglGiro.DateValue;
                    tglJTempo = (DateTime)tbTglJTempo.DateValue;
                    noBGC     = tbNoBGC.Text;
                    cara      = tbJenisGiro.Text;
                }
                else if (cara == "CRD")
                {
                    RpCrd     = tbNominal.Text;
                    ket       = tbKet.Text;
                    cara      = "R";
                    NamaBank  = lookupBankAsal1.NamaBank;
                    Lokasi    = lookupBankAsal1.Lokasi;
                    tglGiro   = (DateTime)tbTglGiro.DateValue;
                    tglJTempo = (DateTime)tbTglJTempo.DateValue;
                    noBGC     = tbNoBGC.Text;
                    bankID    = lookupBankTujuan.BankID;
                    namaBanki = lookupBankTujuan.NamaBank;
                }

                else if (cara == "DBT")
                {
                    RpDbt     = tbNominal.Text;
                    ket       = tbKet.Text;
                    cara      = "D";
                    NamaBank  = lookupBankAsal1.NamaBank;
                    Lokasi    = lookupBankAsal1.Lokasi;
                    tglGiro   = (DateTime)tbTglGiro.DateValue;
                    tglJTempo = (DateTime)tbTglJTempo.DateValue;
                    noBGC     = tbNoBGC.Text;
                    bankID    = lookupBankTujuan.BankID;
                    namaBanki = lookupBankTujuan.NamaBank;
                }


                RowID    = Guid.NewGuid();
                RecordID = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);

                try
                {
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        db.BeginTransaction();
                        addIndenDetail(db);
                        db.CommitTransaction();
                    }

                    if (_isFromPiutang == true)
                    {
                        this.Close();
                    }
                    else
                    {
                        frmPenerimaanBelumTeridentifikasiBrowse frm = new frmPenerimaanBelumTeridentifikasiBrowse();
                        frm = (frmPenerimaanBelumTeridentifikasiBrowse)Caller;
                        frm.IndenRowRefresh(HeaderID);
                        frm.IndenDetailRowRefresh(RowID);
                        frm.IndenDetailFindRow("RowIDID", RowID.ToString());
                    }
                    this.Close();
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
            }
            else
            {
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    using (Database db = new Database(GlobalVar.DBName))
                    {
                        db.Commands.Add(db.CreateCommand("usp_IndenDetail_SOInden_UPDATE"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, rowIDdetail));
                        db.Commands[0].Parameters.Add(new Parameter("@RowIDOrderPenjualan", SqlDbType.UniqueIdentifier, RowIDOrderPenjualan));
                        db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                        db.Commands[0].ExecuteNonQuery();
                    }
                    frmPenerimaanBelumTeridentifikasiBrowse frm = new frmPenerimaanBelumTeridentifikasiBrowse();
                    frm = (frmPenerimaanBelumTeridentifikasiBrowse)Caller;
                    frm.IndenRowRefresh(HeaderID);
                    frm.IndenDetailRowRefresh(rowIDdetail);
                    frm.IndenDetailFindRow("RowIDID", rowIDdetail.ToString());
                    this.Close();
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
            }
        }
Пример #2
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            //if (GlobalVar.Gudang != "2803")
            //{
            bool isCashAllowed = LookupInfoValue.CekIndenTunai();

            //if (!isCashAllowed)
            //{
            //    if (cbCara.Text == "CASH")
            //    {
            //        MessageBox.Show("Input Cash dari Menu Penerimaan Tunai", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //        return;
            //    }
            //}
            //}

            if (!ValidateInput())
            {
                return;
            }

            cara = cbCara.Text;
            if (cara == "CASH")
            {
                cara   = "";
                RpCash = tbNominal.Text;
                ket    = tbKet.Text;
            }
            else if (cara == "TRN")
            {
                cara            = "T";
                RpTrn           = tbNominal.Text;
                ket             = tbKet.Text;
                bankID          = lookupBankTujuan.BankID;
                NamaBank        = lookupBankAsal1.NamaBank;
                Lokasi          = lookupBankAsal1.Lokasi;
                noAcc           = lookupAccountToko1.NoAccount;
                tglRK           = (DateTime)tbTglRK.DateValue;
                rowIDBankTujuan = lookupBankTujuan.RowID;
            }
            else if (cara == "GIRO")
            {
                RpGiro    = tbNominal.Text;
                ket       = tbKet.Text;
                NamaBank  = lookupBankAsal1.NamaBank;
                Lokasi    = lookupBankAsal1.Lokasi;
                noAcc     = lookupAccountToko1.NoAccount;
                tglGiro   = (DateTime)tbTglGiro.DateValue;
                tglJTempo = (DateTime)tbTglJTempo.DateValue;
                noBGC     = tbNoBGC.Text;
                cara      = tbJenisGiro.Text;
            }
            else if (cara == "CRD")
            {
                RpCrd     = tbNominal.Text;
                ket       = tbKet.Text;
                cara      = "R";
                NamaBank  = lookupBankAsal1.NamaBank;
                Lokasi    = lookupBankAsal1.Lokasi;
                tglGiro   = (DateTime)tbTglGiro.DateValue;
                tglJTempo = (DateTime)tbTglJTempo.DateValue;
                noBGC     = tbNoBGC.Text;
                bankID    = lookupBankTujuan.BankID;
                namaBanki = lookupBankTujuan.NamaBank;
            }

            else if (cara == "DBT")
            {
                RpDbt     = tbNominal.Text;
                ket       = tbKet.Text;
                cara      = "D";
                NamaBank  = lookupBankAsal1.NamaBank;
                Lokasi    = lookupBankAsal1.Lokasi;
                tglGiro   = (DateTime)tbTglGiro.DateValue;
                tglJTempo = (DateTime)tbTglJTempo.DateValue;
                noBGC     = tbNoBGC.Text;
                bankID    = lookupBankTujuan.BankID;
                namaBanki = lookupBankTujuan.NamaBank;
            }


            RowID    = Guid.NewGuid();
            RecordID = Tools.CreateFingerPrint(GlobalVar.PerusahaanID, SecurityManager.UserInitial);

            try
            {
                using (Database db = new Database(GlobalVar.DBFinance))
                {
                    db.BeginTransaction();
                    addIndenDetail(db);
                    db.CommitTransaction();
                }

                frmPenerimaanBelumTeridentifikasiBrowse frm = new frmPenerimaanBelumTeridentifikasiBrowse();
                frm = (frmPenerimaanBelumTeridentifikasiBrowse)Caller;
                frm.IndenRowRefresh(HeaderID);
                frm.IndenDetailRowRefresh(RowID);
                frm.IndenDetailFindRow("RowIDID", RowID.ToString());
                this.Close();
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }