You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

352 lines
9.9 KiB
PHTML

@extends('temp.admin')
@php
use NN\Module\DB;
use NN\Module\Perusahaan as perush;
$demo = perush::datalogin()['data'][0]->demo;
$set = [
"title" => "Setting"
, "info" => "Auto jurnal digunakan untuk merecord transaksi USP ke dalam buku besar akun."
, "subtitle" => "Auto Jurnal"
, "submenu" => [
"Pinjaman"
,"Angsuran"
,"Simpanan"
,"Penjualan"
,"Pembelian"
,"Penyesuaian Stok"
]
, "thead" => [
"#","Kode","Akun Debit","Kode Debit","Akun Kredit","Kode Kredit"
]
];
@endphp
@section("content")
@include("temp.temp1", $set)
<noscript id="datainternal">{!! json_encode(DB::query_result_object("SELECT kode id, keterangan text FROM dept")) !!}</noscript>
<noscript id="accc">{!! json_encode(DB::query_result_object("SELECT kode id, nama text, app FROM acc")) !!}</noscript>
@endsection
@section('script')
<script>
_fullScreen();
const dataTable = ['mpinjam', 'mags', 'msimpan', 'totsl', 'totpc', 'py'];
const cekKesalahan = function(callback){
try{
(function(){
if(typeof callback === 'function'){
callback();
}else{
console.log('bukan sebuah function');
}
})();
}catch(e){
console.log(e);
};
};
const PilihanQ = [
[ {id:'pokok', text: "Pokok"} , {id:'bunga', text: "Bunga"} ]
, [ {id:'pokok', text: "Pokok"} , {id:'bunga', text: "Bunga"} ]
, [ {id:'jumlah', text: "Jumlah"} ]
, [
{id:'tunai', text: "Tunai"}
, {id:'hutang', text: "Hutang"}
, {id:'debet', text: "Debet"}
, {id:'qris', text: "Qris"}
]
, [
{id:'tunai', text: "Tunai"}
, {id:'hutang', text: "Hutang"}
, {id:'debet', text: "Debet"}
, {id:'qris', text: "Qris"}
]
, [
{id:'tunai', text: "Tunai"}
]
];
const KodeQ = [
[
{ id:'NON', text: "NON" }
, { id:'REG', text: "REG" }
, { id:'USP1', text: "USP1" }
, { id:'USP2', text: "USP2" }
, { id:'USP3', text: "USP3" }
, { id:'KHUSUS', text: "KHUSUS" }
]
, [
{id:'NON', text: "NON"}
,{id:'REG', text: "REG"}
,{id:'USP1', text: "USP1"}
,{id:'USP2', text: "USP2"}
,{id:'USP3', text: "USP3"}
,{id:'KHUSUS', text: "KHUSUS"}
]
, [
{ id:'BW', text: "Belanja Wajib" }
,{ id:'SM', text: "Simpanan Manasuka" }
,{ id:'SP', text: "Simpanan Pokok" }
,{ id:'SW', text: "Simpanan Wajib" }
,{ id:'SWP', text: "Simpanan Wajib Pinjam" }
,{ id:'TK', text: "Tabungan Khusus" }
,{ id:'PT', text: "Piutang Dagang Toko" }
]
, [
{id:'PJ', text: "Penjualan Offline"}
,{id:'OS', text: "Penjualan Online"}
,{id:'RJ', text: "Retur Penjualan"}
]
, [
{id:'PB', text: "Pembelian"}
,{id:'RB', text: "Retur Pembelian"}
]
, [
{id:'PY', text: "Penyesuaian Stok"}
]
];
const QrSet = function(kode = 'mpinjam'){
window._q = kode;
window._n = PilihanQ[dataTable.indexOf(_q)];
window._j = KodeQ[dataTable.indexOf(_q)];
return `SELECT {select} FROM setbb WHERE table_name = '${kode}' || ORDER BY kode ASC`;
};
var objectForm = {
title : function(){
return 'Auto Jurnal'
},
queryTemp: QrSet(),
table :"setbb",
idform :"containerforms",
newkode: ``,
kode: 'prima',
view: ['kode', 'akundebet','kodedebet', 'akunkredit', 'kodekredit'],
custome: {
akundebet: function(a, b){
var m = _master('accc','accc').cond(a,'id');
if(m.length > 0){
return a + ' - ' + m[0].text;
}
return a;
},
akunkredit: function(a,b){
var m = _master('accc','accc').cond(a,'id');
if(m.length > 0){
return a + ' - ' + m[0].text;
}
return a;
},
password: function(a){
return btoa(a);
},
status: function(a){
if(a == '0'){
return 'Active';
}else{
return 'Tidak Active';
}
}
,setup: function(a){
if(a == 'main'){
return 'Koperasi';
}else if(a == 'acc'){
return 'Akuntansi';
}else{
return 'Setting';
}
}
},
oncreate: function(a){
console.log(_j);
_setval('app', 'usp');
_setval('prima', uuid());
_setval('table_name', window._q);
cekKesalahan(function(){
_setoption('kodedebet', _n );
});
cekKesalahan(function(){
_setoption('kodekredit', _n );
});
cekKesalahan(function(){
_setoption('kode', _j );
});
},
onupdate: function(dt){
window.dt = dt;
_setoption('kodedebet', _n );
_setoption('kodekredit', _n );
_setoption('kode', _j );
_setval('kode', dt.kode );
_setval('kodedebet', dt.kodedebet);
_setval('kodekredit', dt.kodekredit);
},
dataSelect: ["*"],
validasiForm: [],
data: [
{
title: 'Prima',
type: 'text',
name: 'prima',
row: 12,
info: 'kode otomatis',
readonly: true,
action: function(){
},
}
,{
title: 'App',
type: 'select',
name: 'app',
row: 4,
info: 'APP menentukan masuk ke induk atau usp',
data: AppData,
display: 'none',
readonly: false,
action: function(a){
_Evchange(a, function(){
var app = this.value;
var d = _getval('akundebet');
var k = _getval('akunkredit');
var s = _master('accc', 'accc');
_setoption('akundebet', s);
_setoption('akunkredit', s);
_setval('akundebet', d);
_setval('akunkredit', k);
})
},
}
,{
title: 'Kode',
type: 'select',
info: 'Kode dari transaksi',
data: [],
name: 'kode',
row: 6,
readonly: false,
action: function(){
},
}
,{
title: 'TR',
type: 'text',
name: 'tr',
row: 6,
info: 'Digunakan sebagai urutan',
readonly: false,
action: function(){
},
}
,{
title: 'Table',
type: 'text',
name: 'table_name',
row: 6,
display: 'none',
readonly: false,
action: function(){
},
}
,{
title: 'Akun Debet',
type: 'select',
name: 'akundebet',
row: 6,
info: 'Isikan kode tujuan untuk akun debet',
data: _master('accc','accc'),
readonly: false,
action: function(){
},
}
,{
title: 'Kode Debet',
type: 'select',
name: 'kodedebet',
data: [],
info: 'Pilihan ini berdasarkan total transaksi',
row: 6,
readonly: false,
action: function(){
},
}
,{
title: 'Akun Kredit',
type: 'select',
name: 'akunkredit',
row: 6,
info: 'Isikan kode tujuan untuk akun kredit',
data: _master('accc','accc'),
readonly: false,
action: function(){
},
}
,{
title: 'Kode Kredit',
type: 'select',
name: 'kodekredit',
info: 'Pilihan ini berdasarkan total transaksi',
data: [],
row: 6,
readonly: false,
action: function(){
},
}
]
};
try{
(function(){
Array.from(document.querySelectorAll('a[data-kode]')).forEach(function(o){
o.addEventListener('click', function(){
var d = dataTable[this.dataset.kode];
objectForm.queryTemp = QrSet(d);
_load();
},false)
});
})();
}catch(e){
};
$(document).on('click', 'a[kode-data]', function(){
var kode = $(this).attr('kode-data');
alert(kode);
});
@if($demo == 1)
objectForm.disableEditor = true;
@endif
</script>
@include('temp.crudpinjaman')
@endsection
@section('css')
<style>
.dataTable tr td:nth-child(1){
white-space: nowrap;
min-width: 80px;
max-width: 80px;
width: 80px;
}
</style>
<style>
.dataTable tr td{
white-space: nowrap;
}
</style>
@endsection