Ejemplo n.º 1
0
 // die_mod('');
 $conn = conn($sess_db);
 die_conn($conn);
 $conn->begintrans();
 $error = false;
 if ($act == 'Apply') {
     ex_empty($kode_pola_bayar, 'Pola Bayar harus diisi.');
     $query = "DELETE FROM RENCANA WHERE KODE_BLOK = '{$id}'";
     ex_false($conn->execute($query), $query);
     $query = "SELECT KODE_POLA, NAMA_POLA_BAYAR FROM POLA_BAYAR WHERE KODE_POLA_BAYAR = '{$kode_pola_bayar}'";
     $obj = $conn->execute($query);
     $pola_bayar = $obj->fields['KODE_POLA'];
     $nama_pola = $obj->fields['NAMA_POLA_BAYAR'];
     //proses pengambilan harga sk yang dipilih sesuai pola bayar
     $query = "SELECT count(KODE_BLOK) as TOTAL FROM HARGA_SK WHERE KODE_SK=(SELECT KODE_SK FROM STOK WHERE KODE_BLOK = '{$id}') AND KODE_BLOK='{$id}'";
     ex_not_found($conn->Execute($query)->fields['TOTAL'], "Pola Bayar Tidak Tersedia");
     $query = "SELECT ({$pola_bayar}) as HARGA FROM HARGA_SK WHERE KODE_SK = (SELECT KODE_SK FROM STOK WHERE KODE_BLOK = '{$id}') AND KODE_BLOK = '{$id}'";
     $obj = $conn->execute($query);
     $harga_pemesanan = $obj->fields['HARGA'];
     $harga_total = $harga_pemesanan - $tanda_jadi;
     //update harga total yang dipalkai pada tabel spp
     $query = "UPDATE SPP SET \n\t\t\t\t\t\t\tHARGA_TOTAL\t= {$harga_total},\n\t\t\t\t\t\t\tPOLA_BAYAR\t= '{$nama_pola}'\n\t\t\t\t\t\t  WHERE KODE_BLOK\t\t= '{$id}'\n\t\t\t\t\t\t  ";
     ex_false($conn->execute($query), 'Update Pola bayar terlebih dahulu');
     // ex_false($conn->execute($query), $query);
     //proses penghitungan rencana (angsuran)
     /*$b = date("d-m-Y");
     		$pecah_tgl_skrg = explode("-",$b);
     		$tgl_skrg		= $pecah_tgl_skrg[0];
     		$bln_skrg		= $pecah_tgl_skrg[1];
     		$thn_skrg		= $pecah_tgl_skrg[2];
     		
Ejemplo n.º 2
0
<script type="text/javascript">
<?php 
require_once '../../../../config/config.php';
$id = isset($_REQUEST['id']) ? clean($_REQUEST['id']) : '';
$msg = '';
$error = FALSE;
$conn = conn($sess_db);
ex_conn($conn);
try {
    $obj = $conn->Execute("\tSELECT count(*) as TOTAL FROM STOK WHERE KODE_BLOK = '{$id}'");
    ex_not_found($obj->fields['TOTAL'], 'Kode Blok Tidak Terdaftar');
} catch (Exception $e) {
    $msg = $e->getmessage();
    $error = TRUE;
    if ($conn) {
        $conn->rollbacktrans();
    }
}
$query = "SELECT * FROM DETAIL_POLA_BAYAR WHERE KODE_BLOK = '{$id}'";
$harga = $conn->Execute($query);
?>

jQuery(function($) {
	<?php 
if ($error) {
    echo "alert('Data Kode Blok tidak tersedia');";
    echo "jQuery('.harga').val('');";
    echo "jQuery('#kode_blok').val('');";
}
while (!$harga->EOF) {