diff --git a/.gitignore b/.gitignore index 5ef6a52..e6e4404 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,6 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +# kredensial DB aplikasi PHP lama +/old-source/db_login.inc.php \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..4a2596a --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,118 @@ +@AGENTS.md + +# Cleo Minimarket + +Aplikasi Next.js 16 (App Router) untuk menggantikan aplikasi back-office minimarket lama berbasis +PHP di `old-source/`. Kode baru ditulis ulang dari nol; `old-source/` hanya referensi. + +## Stack + +- Next.js 16.4 + React 19, TypeScript strict, Tailwind CSS 4, pnpm 11. +- Drizzle ORM + `pg` untuk database aplikasi (Postgres). +- Better Auth untuk login (direncanakan, pakai Drizzle adapter ke Postgres). +- shadcn/ui untuk komponen UI (direncanakan). + +## Dua database + +| Env var | Database | Isi | +| -------------------- | --------------------------- | ------------------------------------------ | +| `DATABASE_URL` | Postgres (Docker lokal) | Milik aplikasi ini: user, session, auth. | +| `AMIGO_DATABASE_URL` | MariaDB 10.4 `cleo` (LAN) | Data bisnis lama: barang, transaksi, dll. | + +- Postgres dikelola penuh oleh Drizzle migration (`db:generate` lalu `db:migrate`). +- MariaDB `cleo` masih dipakai aplikasi PHP lama. **Jangan pernah** `generate`, `migrate`, atau + `push` ke database ini. Schema Drizzle-nya hanya boleh berasal dari `drizzle-kit pull` + (introspeksi), dengan config terpisah. +- Server MariaDB 10.4, bukan MySQL 8: hindari fitur yang tidak didukung (mis. sebagian fungsi + JSON dan CTE tertentu). Driver: `mysql2`. + +## Struktur folder + +Tanpa folder `src/`. Kode aplikasi di root, sejajar config. + +``` +app/ + (auth)/login/page.tsx halaman publik (belum login) + (dashboard)/layout.tsx cek session; semua halaman di dalamnya wajib login + (dashboard)// + page.tsx Server Component: ambil data lewat data/, render + actions.ts Server Actions fitur ini ('use server') + _components/ komponen khusus fitur ini + api/auth/[...all]/route.ts handler Better Auth (satu-satunya route handler yang wajar) +components/ + ui/ komponen shadcn (generated, jangan diedit manual kecuali perlu) + .tsx komponen yang dipakai lintas fitur +data/ Data Access Layer: fungsi baca/tulis DB, selalu 'server-only' +db/ + index.ts, schema.ts koneksi + schema Postgres + amigo/index.ts, amigo/schema.ts koneksi + schema MariaDB (hasil `drizzle-kit pull`) +lib/ + auth.ts config Better Auth (server) + auth-client.ts client Better Auth + utils.ts helper umum (dibuat shadcn) +drizzle/ file migrasi Postgres (generated, ikut di-commit) +proxy.ts pengganti middleware di Next 16; hanya cek ringan (redirect) +``` + +- Nama folder route dan file: kebab-case. Komponen React: PascalCase untuk nama fungsinya. +- Folder berawalan `_` tidak menjadi route; pakai untuk komponen yang dikolokasikan. +- Route group `(nama)` hanya untuk mengelompokkan layout, tidak muncul di URL. +- Import pakai alias `@/` (mis. `@/db`, `@/data/barang`). + +## Aturan data dan Server Actions + +- **Mutasi (create/update/delete, submit form) wajib lewat Server Action.** Tidak membuat + route handler `app/api/*` untuk hal yang bisa dikerjakan Server Action. +- **Membaca data tidak lewat Server Action.** Server Action adalah POST dan dijalankan berurutan, + jadi tidak cocok untuk fetch. Data dibaca di Server Component dengan memanggil fungsi di `data/`. +- Setiap file `actions.ts` diawali `'use server'`. Setiap action: + 1. Cek session dan hak akses di dalam action itu sendiri. Menyembunyikan tombol di UI bukan + pengaman, karena action bisa dipanggil langsung lewat POST. + 2. Validasi input (`FormData`/argumen) dengan zod sebelum menyentuh DB. + 3. Panggil fungsi di `data/`, bukan query langsung dari action. + 4. Kembalikan objek kecil yang dibutuhkan UI (mis. `{ ok: true }` atau + `{ ok: false, error: string }`), bukan baris DB mentah. + 5. Segarkan cache dengan `revalidatePath`/`updateTag` sebelum `redirect`, karena `redirect` + melempar exception dan kode sesudahnya tidak jalan. +- Form di client memakai `useActionState` untuk menampilkan error/pending dari action. +- File di `data/`, `db/`, dan `lib/auth.ts` diawali `import "server-only"` supaya tidak bisa + ter-import ke client component. Hanya lapisan ini yang membaca `process.env` untuk secret. +- `proxy.ts` hanya untuk redirect cepat berdasarkan ada/tidaknya cookie session. Pemeriksaan + session yang sebenarnya tetap di layout/page dan di setiap action. +- Query selalu lewat Drizzle query builder atau `sql` template tag (parameterized). Jangan + menyusun SQL dengan string concatenation. + +## Kode lama (`old-source/`) + +Read-only, jangan diedit dan jangan di-import. Dipakai untuk memahami fitur dan aturan bisnis. + +- PHP prosedural + jQuery, akses DB lewat `mysqli`/`mysql_*` langsung di tiap halaman. + Banyak query disusun dengan string concatenation (rentan SQL injection); jangan tiru polanya. +- Peta fitur ada di `old-source/menu.php`: Data Master (pelanggan, karyawan, group/sub group + product, rak, supplier, satuan), Barang, Pengadaan, Barcode, Retur Pembelian, Transfer Barang, + Revisi, Laporan Persediaan/Beli/Jual, BON, Pembayaran. +- Helper bisnis di `old-source/func_lib.php`. Hal yang tidak terlihat dari namanya: + - Login lama mencocokkan `karyawan.username` dan `karyawan.password` (hash MD5), lalu + mengisi session `useracc`, `nik`, `job` (`id_pekerjaan`), `namatoko`. + - Jabatan dibaca dari `karyawan.id_pekerjaan` berupa teks: `Pemimpin Toko`, + `Asisten Pemimpin Toko`, `Petugas Administrasi`. + - Harga pokok ditampilkan dalam kode huruf: `convHrgP`/`DeconvHrgP` memetakan angka 1-0 ke + `B R A W N F O X E S`; profit dipetakan `convProfit` ke `D J U N G K A R E T`. + - Format tanggal tampilan `dd-mm-yyyy` (`encTgl`), DB `yyyy-mm-dd` (`decTgl`). + - `bukaKoneksiPusat()` merujuk konstanta `*_PUSAT` yang tidak didefinisikan di + `db_login.inc.php`; fitur koneksi ke DB pusat kemungkinan sudah mati. +- File `*~` dan `(copy)` adalah sisa backup editor, abaikan. + +## Perintah + +``` +pnpm dev jalankan dev server +pnpm build build production +pnpm lint eslint +pnpm exec tsc --noEmit type-check +pnpm db:generate buat migrasi dari db/schema.ts (Postgres) +pnpm db:migrate jalankan migrasi ke Postgres +pnpm db:studio lihat isi Postgres di https://local.drizzle.studio +``` + +Postgres lokal: container Docker `cleo-postgres` (image `postgres:17`, port 5432). diff --git a/old-source/.sync.ffs_db b/old-source/.sync.ffs_db new file mode 100644 index 0000000..591721d Binary files /dev/null and b/old-source/.sync.ffs_db differ diff --git a/old-source/LaporanBeli/ajaxsupplier.php b/old-source/LaporanBeli/ajaxsupplier.php new file mode 100644 index 0000000..6393c13 --- /dev/null +++ b/old-source/LaporanBeli/ajaxsupplier.php @@ -0,0 +1,134 @@ + +prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function cari_supplier($nama) { + if($nama != "") { + $harray = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $nama = addslashes($nama); + $data = $mysqli->query("SELECT kd_supplier, nama_supplier, alamat1, lama_tempo FROM supplier WHERE nama_supplier LIKE '%".$nama."%'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_supplier' => $a['kd_supplier'], + 'nama_supplier' => stripcslashes($a['nama_supplier']), + 'alamat1' => $a['alamat1'], + 'lama_tempo' => $a['lama_tempo'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + }else{ + $harray = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $nama = addslashes($nama); + $data = $mysqli->query("SELECT kd_supplier, nama_supplier, alamat1, lama_tempo FROM supplier"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_supplier' => $a['kd_supplier'], + 'nama_supplier' => stripcslashes($a['nama_supplier']), + 'alamat1' => $a['alamat1'], + 'lama_tempo' => $a['lama_tempo'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function ambil_supplier($id_supplier) { + if ($id_supplier != "") { + $array_data = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM supplier WHERE kd_supplier = '".$id_supplier."'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $array_data[$idx] = array( + 'kd_supplier' => $a['kd_supplier'], + 'nama_supplier' => $a['nama_supplier'], + 'alamat1' => $a['alamat1'], + 'alamat2' => $a['alamat2'], + 'nama_rekening' => $a['nama_rekening'], + 'rekening1' => $a['rekening1'], + 'rekening2' => $a['rekening2'], + 'bank1' => $a['bank1'], + 'bank2' => $a['bank2'], + 'telp' => $a['telp'], + 'ponsel' => $a['ponsel'], + 'email' => $a['email'], + 'fax' => $a['fax'], + 'jns_pembayaran' => $a['jns_pembayaran'], + 'lama_tempo' => $a['lama_tempo'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($array_data); + } +} + + +?> \ No newline at end of file diff --git a/old-source/LaporanBeli/belidlmpdk.php b/old-source/LaporanBeli/belidlmpdk.php new file mode 100644 index 0000000..4177269 --- /dev/null +++ b/old-source/LaporanBeli/belidlmpdk.php @@ -0,0 +1,83 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Pembelian Per Sub Group Product +
+
+
+ + + + +
Range Tanggal: s/d
+
+
+
+
+ +
+ + diff --git a/old-source/LaporanBeli/belikons.php b/old-source/LaporanBeli/belikons.php new file mode 100644 index 0000000..bc38564 --- /dev/null +++ b/old-source/LaporanBeli/belikons.php @@ -0,0 +1,82 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Pembelian Konsinyasi +
+
+
+ + + +
Range Tanggal: s/d
+
+
+
+
+ +
+ + diff --git a/old-source/LaporanBeli/beliperfaktur.php b/old-source/LaporanBeli/beliperfaktur.php new file mode 100644 index 0000000..2c97de7 --- /dev/null +++ b/old-source/LaporanBeli/beliperfaktur.php @@ -0,0 +1,114 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Pembelian Per Faktur +
+
+
+ + + +
Range Tanggal: s/d
Kode Supplier: + +
+
+
+
+
+ +
+
Cari Supplier
+
+ +
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + +
+ + + \ No newline at end of file diff --git a/old-source/LaporanBeli/beliperkategori.php b/old-source/LaporanBeli/beliperkategori.php new file mode 100644 index 0000000..3997a62 --- /dev/null +++ b/old-source/LaporanBeli/beliperkategori.php @@ -0,0 +1,81 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Pembelian Per Kategori +
+
+
+ + +
Range Tanggal: s/d
+
+
+
+
+
+ +
+ + diff --git a/old-source/LaporanBeli/belipersupplier.php b/old-source/LaporanBeli/belipersupplier.php new file mode 100644 index 0000000..fc9d458 --- /dev/null +++ b/old-source/LaporanBeli/belipersupplier.php @@ -0,0 +1,158 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Pembelian Per Supplier +
+ + + + + + + +
+
+
+ + + +
Range Tanggal: s/d
Kode Supplier: + +
+
+
+
+
+
+ + + +
Range Tanggal: s/d
+
+
+
+
+
+ + + + +
Tanggal Jatuh Tempo: s/d
Tanggal Nota: s/d
+
+
+
+
+
+ +
+
Cari Supplier
+
+ +
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + +
+ + \ No newline at end of file diff --git a/old-source/LaporanBeli/belirevisi.php b/old-source/LaporanBeli/belirevisi.php new file mode 100644 index 0000000..d701a3b --- /dev/null +++ b/old-source/LaporanBeli/belirevisi.php @@ -0,0 +1,81 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Revisi Pembelian +
+
+
+ + +
Range Tanggal: s/d
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/old-source/LaporanBeli/brgexp.php b/old-source/LaporanBeli/brgexp.php new file mode 100644 index 0000000..d337237 --- /dev/null +++ b/old-source/LaporanBeli/brgexp.php @@ -0,0 +1,81 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Barang Expired +
+
+
+ + +
Range Tanggal Expired: s/d
+
+
+
+
+
+ +
+ + diff --git a/old-source/LaporanBeli/cetakPembelian.php b/old-source/LaporanBeli/cetakPembelian.php new file mode 100644 index 0000000..d72e52c --- /dev/null +++ b/old-source/LaporanBeli/cetakPembelian.php @@ -0,0 +1,130 @@ +"; + echo "div#divprint{width:100%; border:1px solid #000; padding:20px 0; margin-bottom:25px;font:14pt Gill Sans MT;}"; + echo "table.tbl {border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo ""; + +$noFaktur = $_GET['faktur']; + +print("
"); +if(isset($noFaktur)) +{ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT m.no_order, m.tgl_nota, m.tgl_masuk, m.tgl_jatuh_tempo, m.kd_supplier,s.nama_supplier,m.status,m.diskon, + m.nik,k.nama,m.keterangan,m.tgl_entry, d.kode_barang,d.nm_brg,d.nomor,d.harga_pokok,d.profit, + d.kode_asli,d.jum_fisik,d.lokasi,d.harga_satuan,d.hj_final,m.rp_beli + FROM m_pembelian m,d_pembelian d,supplier s,karyawan k + WHERE d.no_faktur = m.no_faktur + AND m.kd_supplier = s.kd_supplier + AND m.nik = k.nik + AND m.no_faktur = ? + ORDER BY d.kode_barang,d.nm_brg,d.nomor"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,"s",$noFaktur); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$noOrder,$tglNota,$tglMsk,$tglTmpo,$kdSup,$nmSup,$status,$disk, + $nik,$nm,$ket,$tglEntry,$kdBrg,$nmBrg,$no,$hrgP,$profit,$kdAsli,$jumF,$lok,$hrgS,$hjF,$rp_beli); + print("
"); + print("
"); + print("Laporan Penerimaan Barang toko ".$_SESSION['namatoko']."

"); + + $i=0; + $jBeli = 0; + $rpBeli = 0; + while(mysqli_stmt_fetch($stmt)){ + if($i==0){ + if($status=="T"){ + $status="Tunai"; + }else if($status=="H"){ + $status="Tempo"; + }else{ + $status="Konsinyasi"; + } + $disk .= "%"; + $tglNota = encTgl($tglNota); + $tglMsk = encTgl($tglMsk); + $tglTmpo = encTgl($tglTmpo); + $tglEntryS = substr($tglEntry,0,10); + $tglEntryS = encTgl($tglEntryS); + $time = substr($tglEntry,11,8); + + print("
"); + print(""); + print(" + "); + print(" + "); + print(" + "); + print(" + "); + print(" + "); + print(" + "); + + print("
Nomor Faktur : $noFakturTanggal Nota : $tglNota
Nomor Order : $noOrderTanggal Masuk : $tglMsk
Waktu Entry : $tglEntryS / $time Kode Supplier : $kdSup | $nmSup
NIK : $nik | $nmTanggal Jatuh Tempo : $tglTmpo
Status : $statusDiskon Pembelian : $disk
Keterangan : $ket
"); + print(" + + + + + + + + "); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + }else{ + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + } + $i++; + $jBeli += $jumF; + $rpBeli += $jumF * DeconvHrgP($hrgP); + } + print("
KODE ASLIKODE BRGNAMA BARANGKODE BRG LAMANOJUML FISIKHP LAMAPROFIT(%)HJ FINAL
$kdAsli$kdBrg$nmBrg$kdBrglama$no$jumF".DeconvHrgP($hrgP)."".convHrgP($profit)."".number_format($hjF)."
$kdAsli$kdBrg$nmBrg$kdBrglama$no$jumF".DeconvHrgP($hrgP)."".convHrgP($profit)."".number_format($hjF)."

+ + + +
Total Jumlah : $jBeli
Total Rupiah : Rp. ".number_format($rpBeli,2,',','.')."
Total Rupiah Nota : Rp. ".number_format($rp_beli,2,',','.')."
+
"); + } + } + } +} +print("
"); +?> diff --git a/old-source/LaporanBeli/hmenu.php~ b/old-source/LaporanBeli/hmenu.php~ new file mode 100644 index 0000000..a8c9fab --- /dev/null +++ b/old-source/LaporanBeli/hmenu.php~ @@ -0,0 +1,133 @@ + +
+ [ ] | [ Logout ] +
diff --git a/old-source/LaporanBeli/lap_rnc_and_order.php~ b/old-source/LaporanBeli/lap_rnc_and_order.php~ new file mode 100644 index 0000000..3d501e0 --- /dev/null +++ b/old-source/LaporanBeli/lap_rnc_and_order.php~ @@ -0,0 +1,441 @@ +"; + echo "div#divprint{width:1100px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:1000px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".warnaKolPisah{font-weight : bold; background-color: #595454;}"; //#413839 + echo ".master{text-align:left;}"; + echo ""; + + $startDate = $_POST['startDate']; //kd supp + $endDate = $_POST['endDate']; // lini + $bln = $_POST['bulan']; + $thn = $_POST['tahun']; + $thnR = substr($_POST['tahun'],2,2); + + if(bukaKoneksi()){ + global $conn; + + + $queryclear1= "DROP TABLE IF EXISTS tLaporan1"; + $queryclear2= "DROP TABLE IF EXISTS tLaporan2"; + $queryclear3= "DROP TABLE IF EXISTS tLaporan3"; + runQuery($queryclear1); + runQuery($queryclear2); + runQuery($queryclear3); + + if ($startDate != '' and $endDate != '' and $bln != '' and $thn != ''){ + $queryTable1 = "CREATE TABLE tLaporan1 AS + SELECT st.kel_jns kel_jns1, m.kode_strip kode_strip1, d.kode_supplier kode_supplier1, s.nama_supplier nama_supplier1, sum(d.vol_revisi) jml1, sum(d.rupiah_revisi) rp1 + FROM d_rencana_beli d, m_rencana_beli m, supplier s, strip st + WHERE m.bulanR = '$bln' AND m.tahunR = '$thnR' + and m.id=d.id + and d.kode_supplier = s.kd_supplier + and m.kode_strip = st.kd_strip + and d.kode_supplier = '$startDate' + and m.kode_strip = '$endDate' + GROUP BY m.kode_strip,d.kode_supplier "; + + $queryTable2 = "CREATE TABLE tLaporan2 AS + SELECT s.kel_jns kel_jns2,d.kode_strip kode_strip2,m.kd_supplier kode_supplier2, u.nama_supplier nama_supplier2,sum(d.jumlah) jml2,sum(d.harga_order) rp2 + FROM d_order d,m_order m,supplier u,strip s + WHERE d.no_order = m.no_order + AND s.kd_strip = d.kode_strip + AND u.kd_supplier = m.kd_supplier + AND m.kd_supplier = '$startDate' + AND d.kode_strip = '$endDate' + AND month(rencana_datang) = '$bln' AND year(rencana_datang) = '$thn' + GROUP BY d.kode_strip,m.kd_supplier "; + }else if ($startDate != '' and $bln != '' and $thn != ''){ + $queryTable1 = "CREATE TABLE tLaporan1 AS + SELECT st.kel_jns kel_jns1, m.kode_strip kode_strip1, d.kode_supplier kode_supplier1, s.nama_supplier nama_supplier1, sum(d.vol_revisi) jml1, sum(d.rupiah_revisi) rp1 + FROM d_rencana_beli d, m_rencana_beli m, supplier s, strip st + WHERE m.bulanR = '$bln' AND m.tahunR = '$thnR' + and m.id=d.id + and d.kode_supplier = s.kd_supplier + and m.kode_strip = st.kd_strip + and d.kode_supplier = '$startDate' + GROUP BY m.kode_strip,d.kode_supplier "; + + $queryTable2 = "CREATE TABLE tLaporan2 AS + SELECT s.kel_jns kel_jns2,d.kode_strip kode_strip2,m.kd_supplier kode_supplier2, u.nama_supplier nama_supplier2,sum(d.jumlah) jml2,sum(d.harga_order) rp2 + FROM d_order d,m_order m,supplier u,strip s + WHERE d.no_order = m.no_order + AND s.kd_strip = d.kode_strip + AND u.kd_supplier = m.kd_supplier + AND m.kd_supplier = '$startDate' + AND month(rencana_datang) = '$bln' AND year(rencana_datang) = '$thn' + GROUP BY d.kode_strip,m.kd_supplier "; + }else if ($endDate != '' and $bln != '' and $thn != ''){ + $queryTable1 = "CREATE TABLE tLaporan1 AS + SELECT st.kel_jns kel_jns1, m.kode_strip kode_strip1, d.kode_supplier kode_supplier1, s.nama_supplier nama_supplier1, sum(d.vol_revisi) jml1, sum(d.rupiah_revisi) rp1 + FROM d_rencana_beli d, m_rencana_beli m, supplier s, strip st + WHERE m.bulanR = '$bln' AND m.tahunR = '$thnR' + and m.id=d.id + and d.kode_supplier = s.kd_supplier + and m.kode_strip = st.kd_strip + and m.kode_strip = '$endDate' + GROUP BY m.kode_strip,d.kode_supplier "; + + $queryTable2 = "CREATE TABLE tLaporan2 AS + SELECT s.kel_jns kel_jns2,d.kode_strip kode_strip2,m.kd_supplier kode_supplier2, u.nama_supplier nama_supplier2,sum(d.jumlah) jml2,sum(d.harga_order) rp2 + FROM d_order d,m_order m,supplier u,strip s + WHERE d.no_order = m.no_order + AND s.kd_strip = d.kode_strip + AND u.kd_supplier = m.kd_supplier + AND d.kode_strip = '$endDate' + AND month(rencana_datang) = '$bln' AND year(rencana_datang) = '$thn' + GROUP BY d.kode_strip,m.kd_supplier "; + }else{ + $queryTable1 = "CREATE TABLE tLaporan1 AS + SELECT st.kel_jns kel_jns1, m.kode_strip kode_strip1, d.kode_supplier kode_supplier1, s.nama_supplier nama_supplier1, sum(d.vol_revisi) jml1, sum(d.rupiah_revisi) rp1 + FROM d_rencana_beli d, m_rencana_beli m, supplier s, strip st + WHERE m.bulanR = '$bln' AND m.tahunR = '$thnR' + and m.id=d.id + and d.kode_supplier = s.kd_supplier + and m.kode_strip = st.kd_strip + GROUP BY m.kode_strip,d.kode_supplier "; + + $queryTable2 = "CREATE TABLE tLaporan2 AS + SELECT s.kel_jns kel_jns2,d.kode_strip kode_strip2,m.kd_supplier kode_supplier2, u.nama_supplier nama_supplier2,sum(d.jumlah) jml2,sum(d.harga_order) rp2 + FROM d_order d,m_order m,supplier u,strip s + WHERE d.no_order = m.no_order + AND s.kd_strip = d.kode_strip + AND u.kd_supplier = m.kd_supplier + AND month(rencana_datang) = '$bln' AND year(rencana_datang) = '$thn' + GROUP BY d.kode_strip,m.kd_supplier "; + } + + $queryTable3 = "CREATE TABLE tLaporan3 AS + SELECT t3.kel_jns1,t3.kode_strip1,t3.kode_supplier1,t3.nama_supplier1,t3.jml1,t3.rp1,t3.kel_jns2,t3.kode_strip2,t3.kode_supplier2,t3.nama_supplier2,t3.jml2,t3.rp2 + FROM + (SELECT t1.*,t2.* + FROM tLaporan1 t1 LEFT OUTER JOIN tLaporan2 t2 ON + t1.kode_strip1 = t2.kode_strip2 AND t1.kode_supplier1 = t2.kode_supplier2 + UNION ALL + SELECT t1.*,t2.* + FROM tLaporan1 t1 RIGHT OUTER JOIN tLaporan2 t2 ON + t1.kode_strip1 = t2.kode_strip2 AND t1.kode_supplier1 = t2.kode_supplier2 + WHERE t1.kode_strip1 IS NULL) t3 "; + + $query = "SELECT * FROM tLaporan3 t3 ORDER BY t3.kel_jns2,t3.kel_jns1,t3.kode_strip2,t3.kode_strip1,t3.kode_supplier2,t3.kode_supplier1 "; + + runQuery($queryTable1); + runQuery($queryTable2); + runQuery($queryTable3); + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek >= 0){ + mysqli_stmt_bind_result($stmt,$kelJns,$strip,$kd,$nm,$vrenc,$hprenc,$kelJns2,$strip2,$kd2,$nm2,$vrev,$hprev); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['pria']['jmlRev'] = 0; + $ttJmlBeli['pria']['hpRev'] = 0; + + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['wanita']['jmlRev'] = 0; + $ttJmlBeli['wanita']['hpRev'] = 0; + + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['anak']['jmlRev'] = 0; + $ttJmlBeli['anak']['hpRev'] = 0; + + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + $ttJmlBeli['sepatu']['jmlRev'] = 0; + $ttJmlBeli['sepatu']['hpRev'] = 0; + + print("
"); + print("

Laporan Rencana & Realisasi Order



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."

"); + print("Bulan Order : ".$bln."
"); + print("Tahun Order : ".$_POST['tahun']."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $str = array(); + $jmlren = array(); + $rpren = array(); + $stsren = array(); + $jmlrev = array(); + $rprev = array(); + $stsrev = array(); + + while(mysqli_stmt_fetch($stmt)){ + if($kelJns == "P" OR $kelJns2 == "P"){ + $kelJns = "Pria"; + $ttJmlBeli['pria']['jml'] += $vrenc; + $ttJmlBeli['pria']['hp'] += $hprenc; + $ttJmlBeli['pria']['jmlRev'] += $vrev; + $ttJmlBeli['pria']['hpRev'] += $hprev; + $str[$pria]['pria'] = strtoupper($strip); + $str2[$pria]['pria'] = strtoupper($strip2); + $jmlren[$pria]['pria'] = $vrenc; + $rpren[$pria]['pria'] = $hprenc; + $jmlrev[$pria]['pria'] = $vrev; + $rprev[$pria]['pria'] = $hprev; + $kdSupp[$pria]['pria'] = $kd; + $nmSupp[$pria]['pria'] = $nm; + $kdSupp2[$pria]['pria'] = $kd2; + $nmSupp2[$pria]['pria'] = $nm2; + $noord[$pria]['pria'] = $noorder; + $pria++; + }elseif($kelJns == "W" OR $kelJns2 == "W"){ + $kelJns = "Wanita"; + $ttJmlBeli['wanita']['jml'] += $vrenc; + $ttJmlBeli['wanita']['hp'] += $hprenc; + $ttJmlBeli['wanita']['jmlRev'] += $vrev; + $ttJmlBeli['wanita']['hpRev'] += $hprev; + $str[$wanita]['wanita'] = strtoupper($strip); + $str2[$wanita]['wanita'] = strtoupper($strip2); + $jmlren[$wanita]['wanita'] = $vrenc; + $rpren[$wanita]['wanita'] = $hprenc; + $jmlrev[$wanita]['wanita'] = $vrev; + $rprev[$wanita]['wanita'] = $hprev; + $kdSupp[$wanita]['wanita'] = $kd; + $nmSupp[$wanita]['wanita'] = $nm; + $kdSupp2[$wanita]['wanita'] = $kd2; + $nmSupp2[$wanita]['wanita'] = $nm2; + $noord[$wanita]['wanita'] = $noorder; + $wanita++; + }elseif($kelJns == "A" OR $kelJns2 == "A"){ + $kelJns = "Anak"; + $ttJmlBeli['anak']['jml'] += $vrenc; + $ttJmlBeli['anak']['hp'] += $hprenc; + $ttJmlBeli['anak']['jmlRev'] += $vrev; + $ttJmlBeli['anak']['hpRev'] += $hprev; + $str[$anak]['anak'] = strtoupper($strip); + $str2[$anak]['anak'] = strtoupper($strip2); + $jmlren[$anak]['anak'] = $vrenc; + $rpren[$anak]['anak'] = $hprenc; + $jmlrev[$anak]['anak'] = $vrev; + $rprev[$anak]['anak'] = $hprev; + $kdSupp[$anak]['anak'] = $kd; + $nmSupp[$anak]['anak'] = $nm; + $kdSupp2[$anak]['anak'] = $kd2; + $nmSupp2[$anak]['anak'] = $nm2; + $noord[$anak]['anak'] = $noorder; + $anak++; + }else{ + $kelJns = "Sepatu"; + $ttJmlBeli['sepatu']['jml'] += $vrenc; + $ttJmlBeli['sepatu']['hp'] += $hprenc; + $ttJmlBeli['sepatu']['jmlRev'] += $vrev; + $ttJmlBeli['sepatu']['hpRev'] += $hprev; + $str[$sepatu]['sepatu'] = strtoupper($strip); + $str2[$sepatu]['sepatu'] = strtoupper($strip2); + $jmlren[$sepatu]['sepatu'] = $vrenc; + $rpren[$sepatu]['sepatu'] = $hprenc; + $jmlrev[$sepatu]['sepatu'] = $vrev; + $rprev[$sepatu]['sepatu'] = $hprev; + $kdSupp[$sepatu]['sepatu'] = $kd; + $nmSupp[$sepatu]['sepatu'] = $nm; + $kdSupp2[$sepatu]['sepatu'] = $kd2; + $nmSupp2[$sepatu]['sepatu'] = $nm2; + $noord[$sepatu]['sepatu'] = $noorder; + $sepatu++; + } + + } + print(""); + print(""); + print("
"); + +// PRIA ------------------------------------------------------------------------- + if($ttJmlBeli['pria']['jml']!=0 OR $ttJmlBeli['pria']['jmlRev']!=0){ + print("
"); + for($i=0;$i<$pria;$i++){ + if ($str[$i-1]['pria']==$str[$i]['pria'] AND !empty($str[$i]['pria'])){ + print(""); + }else if ($str[$i-1]['pria']==$str[$i]['pria'] AND empty($str[$i]['pria'])){ + if ($str2[$i-1]['pria']==$str2[$i]['pria']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlah1 = 0; + $temphp1 = 0; + $tempjumlah2 = 0; + $temphp2 = 0; + } + }else{ + if($str[$i-1]['pria']!=$str[$i]['pria'] AND empty($str[$i]['pria'])){ + print(""); + print(""); + }else{ + print(""); + print(""); + } + + $tempjumlah1 = 0; + $temphp1 = 0; + $tempjumlah2 = 0; + $temphp2 = 0; + } + $tempjumlah1 += $jmlren[$i]['pria']; + $temphp1 += $rpren[$i]['pria']; + $tempjumlah2 += $jmlrev[$i]['pria']; + $temphp2 += $rprev[$i]['pria']; + } + print(""); + } + + print(""); + +// WANITA ------------------------------------------------------------------------- + if($ttJmlBeli['wanita']['jml']!=0 OR $ttJmlBeli['wanita']['jmlRev']!=0){ + print(""); + for($i=0;$i<$wanita;$i++){ + if ($str[$i-1]['wanita']==$str[$i]['wanita'] AND !empty($str[$i]['wanita'])){ + print(""); + }else if ($str[$i-1]['wanita']==$str[$i]['wanita'] AND empty($str[$i]['wanita'])){ + if ($str2[$i-1]['wanita']==$str2[$i]['wanita']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlah3 = 0; + $temphp3 = 0; + $tempjumlah4 = 0; + $temphp4 = 0; + } + }else{ + if($str[$i-1]['wanita']!=$str[$i]['wanita'] AND empty($str[$i]['wanita'])){ + print(""); + print(""); + }else{ + print(""); + print(""); + } + $tempjumlah3 = 0; + $temphp3 = 0; + $tempjumlah4 = 0; + $temphp4 = 0; + } + $tempjumlah3 += $jmlren[$i]['wanita']; + $temphp3 += $rpren[$i]['wanita']; + $tempjumlah4 += $jmlrev[$i]['wanita']; + $temphp4 += $rprev[$i]['wanita']; + } + print(""); + } + + print(""); +// ANAK ------------------------------------------------------------------------- + if($ttJmlBeli['anak']['jml']!=0 OR $ttJmlBeli['anak']['jmlRev']!=0){ + print(""); + for($i=0;$i<$anak;$i++){ + if ($str[$i-1]['anak']==$str[$i]['anak'] AND !empty($str[$i]['anak'])){ + print(""); + }else if ($str[$i-1]['anak']==$str[$i]['anak'] AND empty($str[$i]['anak'])){ + if ($str2[$i-1]['anak']==$str2[$i]['anak']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlah5 = 0; + $temphp5 = 0; + $tempjumlah6 = 0; + $temphp6 = 0; + } + }else{ + if($str[$i-1]['anak']!=$str[$i]['anak'] AND empty($str[$i]['anak'])){ + print(""); + print(""); + }else{ + print(""); + print(""); + } + $tempjumlah5 = 0; + $temphp5 = 0; + $tempjumlah6 = 0; + $temphp6 = 0; + } + $tempjumlah5 += $jmlren[$i]['anak']; + $temphp5 += $rpren[$i]['anak']; + $tempjumlah6 += $jmlrev[$i]['anak']; + $temphp6 += $rprev[$i]['anak']; + } + print(""); + } + + print(""); +// SEPATU ------------------------------------------------------------------------- + if($ttJmlBeli['sepatu']['jml']!=0 OR $ttJmlBeli['sepatu']['jmlRev']!=0){ + print(""); + for($i=0;$i<$sepatu;$i++){ + if ($str[$i-1]['sepatu']==$str[$i]['sepatu'] AND !empty($str[$i]['sepatu'])){ + print(""); + }else if ($str[$i-1]['sepatu']==$str[$i]['sepatu'] AND empty($str[$i]['sepatu'])){ + if ($str2[$i-1]['sepatu']==$str2[$i]['sepatu']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlah7 = 0; + $temphp7 = 0; + $tempjumlah8 = 0; + $temphp8 = 0; + } + }else{ + print(""); + print(""); + + $tempjumlah7 = 0; + $temphp7 = 0; + $tempjumlah8 = 0; + $temphp8 = 0; + } + $tempjumlah7 += $jmlren[$i]['sepatu']; + $temphp7 += $rpren[$i]['sepatu']; + $tempjumlah8 += $jmlrev[$i]['sepatu']; + $temphp8 += $rprev[$i]['sepatu']; + } + print(""); + } + + print(""); + + $ttjml1 = $ttJmlBeli['pria']['jml'] + $ttJmlBeli['wanita']['jml'] + $ttJmlBeli['anak']['jml'] + $ttJmlBeli['sepatu']['jml']; + $ttrp1 = $ttJmlBeli['pria']['hp'] + $ttJmlBeli['wanita']['hp'] + $ttJmlBeli['anak']['hp'] + $ttJmlBeli['sepatu']['hp']; + $ttjml2 = $ttJmlBeli['pria']['jmlRev'] + $ttJmlBeli['wanita']['jmlRev'] + $ttJmlBeli['anak']['jmlRev'] + $ttJmlBeli['sepatu']['jmlRev']; + $ttrp2 = $ttJmlBeli['pria']['hpRev'] + $ttJmlBeli['wanita']['hpRev'] + $ttJmlBeli['anak']['hpRev'] + $ttJmlBeli['sepatu']['hpRev']; + + print(" + + + + "); + + print("
KategoriLiniKode SuppNama SuppJml RencTotal HP Renc Kode SuppNama SuppJml OrderTotal HP Order Jml SelisihTotal HP Selisih
Pria
~".$str[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")." .".$kdSupp2[$i]['pria']."".$nmSupp2[$i]['pria']."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")." ".number_format($jmlren[$i]['pria']-$jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria']-$rprev[$i]['pria'], 0, ",", ".")."
~".$str2[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")." .".$kdSupp2[$i]['pria']."".$nmSupp2[$i]['pria']."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")." ".number_format($jmlren[$i]['pria']-$jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria']-$rprev[$i]['pria'], 0, ",", ".")."
".number_format($tempjumlah1, 0, ",", ".")."".number_format($temphp1, 0, ",", ".")." ".number_format($tempjumlah2, 0, ",", ".")."".number_format($temphp2, 0, ",", ".")." ".number_format($tempjumlah1-$tempjumlah2, 0, ",", ".")."".number_format($temphp1-$temphp2, 0, ",", ".")."
~".$str2[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")." .".$kdSupp2[$i]['pria']."".$nmSupp2[$i]['pria']."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")." ".number_format($jmlren[$i]['pria']-$jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria']-$rprev[$i]['pria'], 0, ",", ".")."
".number_format($tempjumlah1, 0, ",", ".")."".number_format($temphp1, 0, ",", ".")." ".number_format($tempjumlah2, 0, ",", ".")."".number_format($temphp2, 0, ",", ".")." ".number_format($tempjumlah1-$tempjumlah2, 0, ",", ".")."".number_format($temphp1-$temphp2, 0, ",", ".")."
~".$str2[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")." .".$kdSupp2[$i]['pria']."".$nmSupp2[$i]['pria']."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")." ".number_format($jmlren[$i]['pria']-$jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria']-$rprev[$i]['pria'], 0, ",", ".")."
".number_format($tempjumlah1, 0, ",", ".")."".number_format($temphp1, 0, ",", ".")." ".number_format($tempjumlah2, 0, ",", ".")."".number_format($temphp2, 0, ",", ".")." ".number_format($tempjumlah1-$tempjumlah2, 0, ",", ".")."".number_format($temphp1-$temphp2, 0, ",", ".")."
~".$str[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")." .".$kdSupp2[$i]['pria']."".$nmSupp2[$i]['pria']."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")." ".number_format($jmlren[$i]['pria']-$jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria']-$rprev[$i]['pria'], 0, ",", ".")."
".number_format($tempjumlah1, 0, ",", ".")."".number_format($temphp1, 0, ",", ".")." ".number_format($tempjumlah2, 0, ",", ".")."".number_format($temphp2, 0, ",", ".")." ".number_format($tempjumlah1-$tempjumlah2, 0, ",", ".")."".number_format($temphp1-$temphp2, 0, ",", ".")."
TOTAL PRIA".number_format($ttJmlBeli['pria']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['hp'], 0, ",", ".")." ".number_format($ttJmlBeli['pria']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['hpRev'], 0, ",", ".")." ".number_format($ttJmlBeli['pria']['jml']-$ttJmlBeli['pria']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['hp']-$ttJmlBeli['pria']['hpRev'], 0, ",", ".")."
Wanita
~".$str[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")." .".$kdSupp2[$i]['wanita']."".$nmSupp2[$i]['wanita']."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")."".number_format($jmlren[$i]['wanita']-$jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita']-$rprev[$i]['wanita'], 0, ",", ".")."
~".$str2[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")." .".$kdSupp2[$i]['wanita']."".$nmSupp2[$i]['wanita']."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")."".number_format($jmlren[$i]['wanita']-$jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita']-$rprev[$i]['wanita'], 0, ",", ".")."
".number_format($tempjumlah3, 0, ",", ".")."".number_format($temphp3, 0, ",", ".")." ".number_format($tempjumlah4, 0, ",", ".")."".number_format($temphp4, 0, ",", ".")."".number_format($tempjumlah3-$tempjumlah4, 0, ",", ".")."".number_format($temphp3-$temphp4, 0, ",", ".")."
~".$str2[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")." .".$kdSupp2[$i]['wanita']."".$nmSupp2[$i]['wanita']."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")."".number_format($jmlren[$i]['wanita']-$jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita']-$rprev[$i]['wanita'], 0, ",", ".")."
".number_format($tempjumlah1, 0, ",", ".")."".number_format($temphp1, 0, ",", ".")." ".number_format($tempjumlah2, 0, ",", ".")."".number_format($temphp2, 0, ",", ".")." ".number_format($tempjumlah1-$tempjumlah2, 0, ",", ".")."".number_format($temphp1-$temphp2, 0, ",", ".")."
~".$str2[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")." .".$kdSupp2[$i]['wanita']."".$nmSupp2[$i]['wanita']."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")." ".number_format($jmlren[$i]['wanita']-$jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita']-$rprev[$i]['wanita'], 0, ",", ".")."
".number_format($tempjumlah3, 0, ",", ".")."".number_format($temphp3, 0, ",", ".")." ".number_format($tempjumlah4, 0, ",", ".")."".number_format($temphp4, 0, ",", ".")."".number_format($tempjumlah3-$tempjumlah4, 0, ",", ".")."".number_format($temphp3-$temphp4, 0, ",", ".")."
~".$str[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")." .".$kdSupp2[$i]['wanita']."".$nmSupp2[$i]['wanita']."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")."".number_format($jmlren[$i]['wanita']-$jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita']-$rprev[$i]['wanita'], 0, ",", ".")."
".number_format($tempjumlah3, 0, ",", ".")."".number_format($temphp3, 0, ",", ".")." ".number_format($tempjumlah4, 0, ",", ".")."".number_format($temphp4, 0, ",", ".")."".number_format($tempjumlah3-$tempjumlah4, 0, ",", ".")."".number_format($temphp3-$temphp4, 0, ",", ".")."
TOTAL WANITA".number_format($ttJmlBeli['wanita']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['hp'], 0, ",", ".")." ".number_format($ttJmlBeli['wanita']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['hpRev'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['jml']-$ttJmlBeli['wanita']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['hp']-$ttJmlBeli['wanita']['hpRev'], 0, ",", ".")."
Anak
~".$str[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")." .".$kdSupp2[$i]['anak']."".$nmSupp2[$i]['anak']."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")."".number_format($jmlren[$i]['anak']-$jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak']-$rprev[$i]['anak'], 0, ",", ".")."
~".$str2[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")." .".$kdSupp2[$i]['anak']."".$nmSupp2[$i]['anak']."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")."".number_format($jmlren[$i]['anak']-$jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak']-$rprev[$i]['anak'], 0, ",", ".")."
".number_format($tempjumlah5, 0, ",", ".")."".number_format($temphp5, 0, ",", ".")." ".number_format($tempjumlah6, 0, ",", ".")."".number_format($temphp6, 0, ",", ".")."".number_format($tempjumlah5-$tempjumlah6, 0, ",", ".")."".number_format($temphp5-$temphp6, 0, ",", ".")."
~".$str2[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")." .".$kdSupp2[$i]['anak']."".$nmSupp2[$i]['anak']."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")."".number_format($jmlren[$i]['anak']-$jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak']-$rprev[$i]['anak'], 0, ",", ".")."
".number_format($tempjumlah1, 0, ",", ".")."".number_format($temphp1, 0, ",", ".")." ".number_format($tempjumlah2, 0, ",", ".")."".number_format($temphp2, 0, ",", ".")." ".number_format($tempjumlah1-$tempjumlah2, 0, ",", ".")."".number_format($temphp1-$temphp2, 0, ",", ".")."
~".$str2[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")." .".$kdSupp2[$i]['anak']."".$nmSupp2[$i]['anak']."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")." ".number_format($jmlren[$i]['anak']-$jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak']-$rprev[$i]['anak'], 0, ",", ".")."
".number_format($tempjumlah5, 0, ",", ".")."".number_format($temphp5, 0, ",", ".")." ".number_format($tempjumlah6, 0, ",", ".")."".number_format($temphp6, 0, ",", ".")."".number_format($tempjumlah5-$tempjumlah6, 0, ",", ".")."".number_format($temphp5-$temphp6, 0, ",", ".")."
~".$str[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")." .".$kdSupp2[$i]['anak']."".$nmSupp2[$i]['anak']."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")."".number_format($jmlren[$i]['anak']-$jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak']-$rprev[$i]['anak'], 0, ",", ".")."
".number_format($tempjumlah5, 0, ",", ".")."".number_format($temphp5, 0, ",", ".")." ".number_format($tempjumlah6, 0, ",", ".")."".number_format($temphp6, 0, ",", ".")."".number_format($tempjumlah5-$tempjumlah6, 0, ",", ".")."".number_format($temphp5-$temphp6, 0, ",", ".")."
TOTAL ANAK".number_format($ttJmlBeli['anak']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['hp'], 0, ",", ".")." ".number_format($ttJmlBeli['anak']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['hpRev'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['jml']-$ttJmlBeli['anak']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['hp']-$ttJmlBeli['anak']['hpRev'], 0, ",", ".")."
Sepatu
~".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlren[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu'], 0, ",", ".")." .".$kdSupp2[$i]['sepatu']."".$nmSupp2[$i]['sepatu']."".number_format($jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rprev[$i]['sepatu'], 0, ",", ".")."".number_format($jmlren[$i]['sepatu']-$jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu']-$rprev[$i]['sepatu'], 0, ",", ".")."
~".$str2[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlren[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu'], 0, ",", ".")." .".$kdSupp2[$i]['sepatu']."".$nmSupp2[$i]['sepatu']."".number_format($jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rprev[$i]['sepatu'], 0, ",", ".")."".number_format($jmlren[$i]['sepatu']-$jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu']-$rprev[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlah7, 0, ",", ".")."".number_format($temphp7, 0, ",", ".")." ".number_format($tempjumlah8, 0, ",", ".")."".number_format($temphp8, 0, ",", ".")."".number_format($tempjumlah7-$tempjumlah8, 0, ",", ".")."".number_format($temphp7-$temphp8, 0, ",", ".")."
~".$str2[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlren[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu'], 0, ",", ".")." .".$kdSupp2[$i]['sepatu']."".$nmSupp2[$i]['sepatu']."".number_format($jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rprev[$i]['sepatu'], 0, ",", ".")."".number_format($jmlren[$i]['sepatu']-$jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu']-$rprev[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlah7, 0, ",", ".")."".number_format($temphp7, 0, ",", ".")." ".number_format($tempjumlah8, 0, ",", ".")."".number_format($temphp8, 0, ",", ".")."".number_format($tempjumlah7-$tempjumlah8, 0, ",", ".")."".number_format($temphp7-$temphp8, 0, ",", ".")."
~".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlren[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu'], 0, ",", ".")." .".$kdSupp2[$i]['sepatu']."".$nmSupp2[$i]['sepatu']."".number_format($jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rprev[$i]['sepatu'], 0, ",", ".")."".number_format($jmlren[$i]['sepatu']-$jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu']-$rprev[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlah7, 0, ",", ".")."".number_format($temphp7, 0, ",", ".")." ".number_format($tempjumlah8, 0, ",", ".")."".number_format($temphp8, 0, ",", ".")."".number_format($tempjumlah7-$tempjumlah8, 0, ",", ".")."".number_format($temphp7-$temphp8, 0, ",", ".")."
TOTAL SEPATU".number_format($ttJmlBeli['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp'], 0, ",", ".")." ".number_format($ttJmlBeli['sepatu']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hpRev'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['jml']-$ttJmlBeli['sepatu']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp']-$ttJmlBeli['sepatu']['hpRev'], 0, ",", ".")."
T O T A L : ".number_format($ttjml1, 0, ",", ".")."".number_format($ttrp1, 0, ",", ".")."".number_format($ttjml2, 0, ",", ".")."".number_format($ttrp2, 0, ",", ".")."".number_format($ttjml1-$ttjml2, 0, ",", ".")."".number_format($ttrp1-$ttrp2, 0, ",", ".")."

"); + }else{ + echo "Tidak ada data untuk tanggal tersebut!"; + } + } + + } +?> diff --git a/old-source/LaporanBeli/lap_rnc_order_brgdtg.php~ b/old-source/LaporanBeli/lap_rnc_order_brgdtg.php~ new file mode 100644 index 0000000..b903e62 --- /dev/null +++ b/old-source/LaporanBeli/lap_rnc_order_brgdtg.php~ @@ -0,0 +1,642 @@ +"; + echo "div#divprint{width:1100px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:1000px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".ijo{font-weight : bold; background-color : #00FF00;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".warnaKolPisah{font-weight : bold; background-color: #595454;}"; //#413839 + echo ".master{text-align:left;}"; + echo ""; + + $startDate = $_POST['startDate']; //kd supp + $endDate = $_POST['endDate']; // lini + $bln = $_POST['bulan']; + $thn = $_POST['tahun']; + $thnR = substr($_POST['tahun'],2,2); + + if(bukaKoneksi()){ + global $conn; + + + $queryclear1= "DROP TABLE IF EXISTS tLaporan1"; + $queryclear2= "DROP TABLE IF EXISTS tLaporan2"; + $queryclear3= "DROP TABLE IF EXISTS tLaporan3"; + $queryclear4= "DROP TABLE IF EXISTS tLaporan4"; + $queryclear5= "DROP TABLE IF EXISTS tLaporan5"; + runQuery($queryclear1); + runQuery($queryclear2); + runQuery($queryclear3); + runQuery($queryclear4); + runQuery($queryclear5); + + if ($startDate != '' and $endDate != '' and $bln != '' and $thn != ''){ + $queryTable1 = "CREATE TABLE tLaporan1 AS + SELECT st.kel_jns kel_jns1, m.kode_strip kode_strip1, d.kode_supplier kode_supplier1, s.nama_supplier nama_supplier1, sum(d.vol_revisi) jml1, sum(d.rupiah_revisi) rp1 + FROM d_rencana_beli d, m_rencana_beli m, supplier s, strip st + WHERE m.bulanR = '$bln' AND m.tahunR = '$thnR' + and m.id=d.id + and d.kode_supplier = s.kd_supplier + and m.kode_strip = st.kd_strip + and d.kode_supplier = '$startDate' + and m.kode_strip = '$endDate' + GROUP BY m.kode_strip,d.kode_supplier "; + + $queryTable2 = "CREATE TABLE tLaporan2 AS + SELECT s.kel_jns kel_jns2,d.kode_strip kode_strip2,m.kd_supplier kode_supplier2, u.nama_supplier nama_supplier2,sum(d.jumlah) jml2,sum(d.harga_order) rp2 + FROM d_order d,m_order m,supplier u,strip s + WHERE d.no_order = m.no_order + AND s.kd_strip = d.kode_strip + AND u.kd_supplier = m.kd_supplier + AND m.kd_supplier = '$startDate' + AND d.kode_strip = '$endDate' + AND month(rencana_datang) = '$bln' AND year(rencana_datang) = '$thn' + GROUP BY d.kode_strip,m.kd_supplier "; + + $queryTable3 = "CREATE TABLE tLaporan3 AS + SELECT s.kel_jns kel_jns3,left(d.kode_barang,2) kode_strip3,m.kd_supplier kode_supplier3, u.nama_supplier nama_supplier3,sum(d.jum_fisik) jml3,sum(d.harga_satuan) rp3 + FROM d_pembelian d,m_pembelian m,supplier u,strip s + WHERE d.no_faktur = m.no_faktur + AND s.kd_strip = left(d.kode_barang,2) + AND u.kd_supplier = m.kd_supplier + AND m.kd_supplier = '$startDate' + AND s.kd_strip = '$endDate' + AND month(tgl_masuk) = '$bln' AND year(tgl_masuk) = '$thn' + GROUP BY s.kd_strip,m.kd_supplier"; + + }else if ($startDate != '' and $bln != '' and $thn != ''){ + $queryTable1 = "CREATE TABLE tLaporan1 AS + SELECT st.kel_jns kel_jns1, m.kode_strip kode_strip1, d.kode_supplier kode_supplier1, s.nama_supplier nama_supplier1, sum(d.vol_revisi) jml1, sum(d.rupiah_revisi) rp1 + FROM d_rencana_beli d, m_rencana_beli m, supplier s, strip st + WHERE m.bulanR = '$bln' AND m.tahunR = '$thnR' + and m.id=d.id + and d.kode_supplier = s.kd_supplier + and m.kode_strip = st.kd_strip + and d.kode_supplier = '$startDate' + GROUP BY m.kode_strip,d.kode_supplier "; + + $queryTable2 = "CREATE TABLE tLaporan2 AS + SELECT s.kel_jns kel_jns2,d.kode_strip kode_strip2,m.kd_supplier kode_supplier2, u.nama_supplier nama_supplier2,sum(d.jumlah) jml2,sum(d.harga_order) rp2 + FROM d_order d,m_order m,supplier u,strip s + WHERE d.no_order = m.no_order + AND s.kd_strip = d.kode_strip + AND u.kd_supplier = m.kd_supplier + AND m.kd_supplier = '$startDate' + AND month(rencana_datang) = '$bln' AND year(rencana_datang) = '$thn' + GROUP BY d.kode_strip,m.kd_supplier "; + + $queryTable3 = "CREATE TABLE tLaporan3 AS + SELECT s.kel_jns kel_jns3,left(d.kode_barang,2) kode_strip3,m.kd_supplier kode_supplier3, u.nama_supplier nama_supplier3,sum(d.jum_fisik) jml3,sum(d.harga_satuan) rp3 + FROM d_pembelian d,m_pembelian m,supplier u,strip s + WHERE d.no_faktur = m.no_faktur + AND s.kd_strip = left(d.kode_barang,2) + AND u.kd_supplier = m.kd_supplier + AND m.kd_supplier = '$startDate' + AND month(tgl_masuk) = '$bln' AND year(tgl_masuk) = '$thn' + GROUP BY s.kd_strip,m.kd_supplier"; + + }else if ($endDate != '' and $bln != '' and $thn != ''){ + $queryTable1 = "CREATE TABLE tLaporan1 AS + SELECT st.kel_jns kel_jns1, m.kode_strip kode_strip1, d.kode_supplier kode_supplier1, s.nama_supplier nama_supplier1, sum(d.vol_revisi) jml1, sum(d.rupiah_revisi) rp1 + FROM d_rencana_beli d, m_rencana_beli m, supplier s, strip st + WHERE m.bulanR = '$bln' AND m.tahunR = '$thnR' + and m.id=d.id + and d.kode_supplier = s.kd_supplier + and m.kode_strip = st.kd_strip + and m.kode_strip = '$endDate' + GROUP BY m.kode_strip,d.kode_supplier "; + + $queryTable2 = "CREATE TABLE tLaporan2 AS + SELECT s.kel_jns kel_jns2,d.kode_strip kode_strip2,m.kd_supplier kode_supplier2, u.nama_supplier nama_supplier2,sum(d.jumlah) jml2,sum(d.harga_order) rp2 + FROM d_order d,m_order m,supplier u,strip s + WHERE d.no_order = m.no_order + AND s.kd_strip = d.kode_strip + AND u.kd_supplier = m.kd_supplier + AND d.kode_strip = '$endDate' + AND month(rencana_datang) = '$bln' AND year(rencana_datang) = '$thn' + GROUP BY d.kode_strip,m.kd_supplier "; + + $queryTable3 = "CREATE TABLE tLaporan3 AS + SELECT s.kel_jns kel_jns3,left(d.kode_barang,2) kode_strip3,m.kd_supplier kode_supplier3, u.nama_supplier nama_supplier3,sum(d.jum_fisik) jml3,sum(d.harga_satuan) rp3 + FROM d_pembelian d,m_pembelian m,supplier u,strip s + WHERE d.no_faktur = m.no_faktur + AND s.kd_strip = left(d.kode_barang,2) + AND u.kd_supplier = m.kd_supplier + AND s.kd_strip = '$endDate' + AND month(tgl_masuk) = '$bln' AND year(tgl_masuk) = '$thn' + GROUP BY s.kd_strip,m.kd_supplier"; + + }else{ + $queryTable1 = "CREATE TABLE tLaporan1 AS + SELECT st.kel_jns kel_jns1, m.kode_strip kode_strip1, d.kode_supplier kode_supplier1, s.nama_supplier nama_supplier1, sum(d.vol_revisi) jml1, sum(d.rupiah_revisi) rp1 + FROM d_rencana_beli d, m_rencana_beli m, supplier s, strip st + WHERE m.bulanR = '$bln' AND m.tahunR = '$thnR' + and m.id=d.id + and d.kode_supplier = s.kd_supplier + and m.kode_strip = st.kd_strip + GROUP BY m.kode_strip,d.kode_supplier "; + + $queryTable2 = "CREATE TABLE tLaporan2 AS + SELECT s.kel_jns kel_jns2,d.kode_strip kode_strip2,m.kd_supplier kode_supplier2, u.nama_supplier nama_supplier2,sum(d.jumlah) jml2,sum(d.harga_order) rp2 + FROM d_order d,m_order m,supplier u,strip s + WHERE d.no_order = m.no_order + AND s.kd_strip = d.kode_strip + AND u.kd_supplier = m.kd_supplier + AND month(rencana_datang) = '$bln' AND year(rencana_datang) = '$thn' + GROUP BY d.kode_strip,m.kd_supplier "; + + $queryTable3 = "CREATE TABLE tLaporan3 AS + SELECT s.kel_jns kel_jns3,left(d.kode_barang,2) kode_strip3,m.kd_supplier kode_supplier3, u.nama_supplier nama_supplier3,sum(d.jum_fisik) jml3,sum(d.harga_satuan) rp3 + FROM d_pembelian d,m_pembelian m,supplier u,strip s + WHERE d.no_faktur = m.no_faktur + AND s.kd_strip = left(d.kode_barang,2) + AND u.kd_supplier = m.kd_supplier + AND month(tgl_masuk) = '$bln' AND year(tgl_masuk) = '$thn' + GROUP BY s.kd_strip,m.kd_supplier"; + } + + $queryTable4 = "CREATE TABLE tLaporan4 AS + SELECT t4.kel_jns1,t4.kode_strip1,t4.kode_supplier1,t4.nama_supplier1,t4.jml1,t4.rp1,t4.kel_jns2,t4.kode_strip2,t4.kode_supplier2,t4.nama_supplier2,t4.jml2,t4.rp2 + FROM + (SELECT t1.*,t2.* + FROM tLaporan1 t1 LEFT OUTER JOIN tLaporan2 t2 ON + t1.kode_strip1 = t2.kode_strip2 AND t1.kode_supplier1 = t2.kode_supplier2 + UNION ALL + SELECT t1.*,t2.* + FROM tLaporan1 t1 RIGHT OUTER JOIN tLaporan2 t2 ON + t1.kode_strip1 = t2.kode_strip2 AND t1.kode_supplier1 = t2.kode_supplier2 + WHERE t1.kode_strip1 IS NULL) t4 "; + + $queryTable5 = "CREATE TABLE tLaporan5 AS + SELECT * from tLaporan4 t4 LEFT JOIN tLaporan3 t3 + ON (t4.kode_strip2 = t3.kode_strip3 AND t4.kode_supplier2 = t3.kode_supplier3)"; + + $query = "SELECT * FROM tLaporan5 t ORDER BY t.kel_jns2,t.kel_jns1,t.kode_strip2,t.kode_strip1,t.kode_supplier2,t.kode_supplier1 "; + + runQuery($queryTable1); + runQuery($queryTable2); + runQuery($queryTable3); + runQuery($queryTable4); + runQuery($queryTable5); + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek >= 0){ + mysqli_stmt_bind_result($stmt,$kelJns,$strip,$kd,$nm,$vrenc,$hprenc,$kelJns2,$strip2,$kd2,$nm2,$vrev,$hprev,$kelJnsBeli,$stripBeli,$kdBeli,$nmBeli,$vBeli,$hpBeli); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['pria']['jmlRev'] = 0; + $ttJmlBeli['pria']['hpRev'] = 0; + $ttJmlBeli['pria']['jmlBeli'] = 0; + $ttJmlBeli['pria']['hpBeli'] = 0; + + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['wanita']['jmlRev'] = 0; + $ttJmlBeli['wanita']['hpRev'] = 0; + $ttJmlBeli['wanita']['jmlBeli'] = 0; + $ttJmlBeli['wanita']['hpBeli'] = 0; + + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['anak']['jmlRev'] = 0; + $ttJmlBeli['anak']['hpRev'] = 0; + $ttJmlBeli['anak']['jmlBeli'] = 0; + $ttJmlBeli['anak']['hpBeli'] = 0; + + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + $ttJmlBeli['sepatu']['jmlRev'] = 0; + $ttJmlBeli['sepatu']['hpRev'] = 0; + $ttJmlBeli['sepatu']['jmlBeli'] = 0; + $ttJmlBeli['sepatu']['hpBeli'] = 0; + + print("
"); + print("

Laporan Rencana, Realisasi Order & Barang Datang



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."

"); + print("Bulan Order : ".$bln."
"); + print("Tahun Order : ".$_POST['tahun']."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $str = array(); + $strOrd = array(); + $strBeli = array(); + $jmlren = array(); + $rpren = array(); + $jmlrev = array(); + $rprev = array(); + $jmlBeli = array(); + $rpBeli = array(); + + while(mysqli_stmt_fetch($stmt)){ + if($kelJns == "P" OR $kelJns2 == "P"){ + $kelJns = "Pria"; + $ttJmlBeli['pria']['jml'] += $vrenc; + $ttJmlBeli['pria']['hp'] += $hprenc; + $ttJmlBeli['pria']['jmlRev'] += $vrev; + $ttJmlBeli['pria']['hpRev'] += $hprev; + $ttJmlBeli['pria']['jmlBeli'] += $vBeli; + $ttJmlBeli['pria']['hpBeli'] += $hpBeli; + $str[$pria]['pria'] = strtoupper($strip); + $strOrd[$pria]['pria'] = strtoupper($strip2); + $strBeli[$pria]['pria'] = strtoupper($stripBeli); + $jmlren[$pria]['pria'] = $vrenc; + $rpren[$pria]['pria'] = $hprenc; + $jmlrev[$pria]['pria'] = $vrev; + $rprev[$pria]['pria'] = $hprev; + $jmlBeli[$pria]['pria'] = $vBeli; + $rpBeli[$pria]['pria'] = $hpBeli; + $kdSupp[$pria]['pria'] = $kd; + $nmSupp[$pria]['pria'] = $nm; + $kdSuppOrd[$pria]['pria'] = $kd2; + $nmSuppOrd[$pria]['pria'] = $nm2; + $kdSuppBeli[$pria]['pria'] = $kdBeli; + $nmSuppBeli[$pria]['pria'] = $nmBeli; + $pria++; + }elseif($kelJns == "W" OR $kelJns2 == "W"){ + $kelJns = "Wanita"; + $ttJmlBeli['wanita']['jml'] += $vrenc; + $ttJmlBeli['wanita']['hp'] += $hprenc; + $ttJmlBeli['wanita']['jmlRev'] += $vrev; + $ttJmlBeli['wanita']['hpRev'] += $hprev; + $ttJmlBeli['wanita']['jmlBeli'] += $vBeli; + $ttJmlBeli['wanita']['hpBeli'] += $hpBeli; + $str[$wanita]['wanita'] = strtoupper($strip); + $strOrd[$wanita]['wanita'] = strtoupper($strip2); + $strBeli[$wanita]['wanita'] = strtoupper($stripBeli); + $jmlren[$wanita]['wanita'] = $vrenc; + $rpren[$wanita]['wanita'] = $hprenc; + $jmlrev[$wanita]['wanita'] = $vrev; + $rprev[$wanita]['wanita'] = $hprev; + $jmlBeli[$wanita]['wanita'] = $vBeli; + $rpBeli[$wanita]['wanita'] = $hpBeli; + $kdSupp[$wanita]['wanita'] = $kd; + $nmSupp[$wanita]['wanita'] = $nm; + $kdSuppOrd[$wanita]['wanita'] = $kd2; + $nmSuppOrd[$wanita]['wanita'] = $nm2; + $kdSuppBeli[$wanita]['wanita'] = $kdBeli; + $nmSuppBeli[$wanita]['wanita'] = $nmBeli; + $wanita++; + }elseif($kelJns == "A" OR $kelJns2 == "A"){ + $kelJns = "Anak"; + $ttJmlBeli['anak']['jml'] += $vrenc; + $ttJmlBeli['anak']['hp'] += $hprenc; + $ttJmlBeli['anak']['jmlRev'] += $vrev; + $ttJmlBeli['anak']['hpRev'] += $hprev; + $ttJmlBeli['anak']['jmlBeli'] += $vBeli; + $ttJmlBeli['anak']['hpBeli'] += $hpBeli; + $str[$anak]['anak'] = strtoupper($strip); + $strOrd[$anak]['anak'] = strtoupper($strip2); + $strBeli[$anak]['anak'] = strtoupper($stripBeli); + $jmlren[$anak]['anak'] = $vrenc; + $rpren[$anak]['anak'] = $hprenc; + $jmlrev[$anak]['anak'] = $vrev; + $rprev[$anak]['anak'] = $hprev; + $jmlBeli[$anak]['anak'] = $vBeli; + $rpBeli[$anak]['anak'] = $hpBeli; + $kdSupp[$anak]['anak'] = $kd; + $nmSupp[$anak]['anak'] = $nm; + $kdSuppOrd[$anak]['anak'] = $kd2; + $nmSuppOrd[$anak]['anak'] = $nm2; + $kdSuppBeli[$anak]['anak'] = $kdBeli; + $nmSuppBeli[$anak]['anak'] = $nmBeli; + $anak++; + }else{ + $kelJns = "Sepatu"; + $ttJmlBeli['sepatu']['jml'] += $vrenc; + $ttJmlBeli['sepatu']['hp'] += $hprenc; + $ttJmlBeli['sepatu']['jmlRev'] += $vrev; + $ttJmlBeli['sepatu']['hpRev'] += $hprev; + $ttJmlBeli['sepatu']['jmlBeli'] += $vBeli; + $ttJmlBeli['sepatu']['hpBeli'] += $hpBeli; + $str[$sepatu]['sepatu'] = strtoupper($strip); + $strOrd[$sepatu]['sepatu'] = strtoupper($strip2); + $strBeli[$sepatu]['sepatu'] = strtoupper($stripBeli); + $jmlren[$sepatu]['sepatu'] = $vrenc; + $rpren[$sepatu]['sepatu'] = $hprenc; + $jmlrev[$sepatu]['sepatu'] = $vrev; + $rprev[$sepatu]['sepatu'] = $hprev; + $jmlBeli[$sepatu]['sepatu'] = $vBeli; + $rpBeli[$sepatu]['sepatu'] = $hpBeli; + $kdSupp[$sepatu]['sepatu'] = $kd; + $nmSupp[$sepatu]['sepatu'] = $nm; + $kdSuppOrd[$sepatu]['sepatu'] = $kd2; + $nmSuppOrd[$sepatu]['sepatu'] = $nm2; + $kdSuppBeli[$sepatu]['sepatu'] = $kdBeli; + $nmSuppBeli[$sepatu]['sepatu'] = $nmBeli; + $sepatu++; + } + + } + print(""); + print(""); + print("
"); + +// PRIA ------------------------------------------------------------------------- + if($ttJmlBeli['pria']['jml']!=0 OR $ttJmlBeli['pria']['jmlRev']!=0){ + print("
"); + for($i=0;$i<$pria;$i++){ + if ($str[$i-1]['pria']==$str[$i]['pria'] AND !empty($str[$i]['pria'])){ + if ($str[$i-1]['pria']==$str[$i]['pria'] AND empty($strOrd[$i]['pria'])){ + print(""); + }else{ + print(""); + } + + }else if ($str[$i-1]['pria']==$str[$i]['pria'] AND empty($str[$i]['pria'])){ + if ($strOrd[$i-1]['pria']==$strOrd[$i]['pria']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlahA = 0; + $temphpA = 0; + $tempjumlahB = 0; + $temphpB = 0; + $tempjumlahC = 0; + $temphpC = 0; + } + + }else{ + if (empty($strOrd[$i]['pria'])){ + print(""); + print(""); + }else if ($str[$i-1]['pria']!=$str[$i]['pria'] AND empty($str[$i]['pria'])){ + $tempjspria = 0; + $temprppria = 0; + print(""); + print(""); + }else{ + print(""); + print(""); + } + $tempjumlahA = 0; + $temphpA = 0; + $tempjumlahB = 0; + $temphpB = 0; + $tempjumlahC = 0; + $temphpC = 0; + } + $tempjumlahA += $jmlren[$i]['pria']; + $temphpA += $rpren[$i]['pria']; + $tempjumlahB += $jmlrev[$i]['pria']; + $temphpB += $rprev[$i]['pria']; + $tempjumlahC += $jmlBeli[$i]['pria']; + $temphpC += $rpBeli[$i]['pria']; + $tempjspria += ($jmlren[$i]['pria']-$jmlrev[$i]['pria']); + $temprppria += ($rpren[$i]['pria']-$rprev[$i]['pria']); + + } + print(""); + } + print(""); + if( ($ttJmlBeli['pria']['jmlRev']>$ttJmlBeli['pria']['jmlBeli']) OR ($ttJmlBeli['pria']['hpRev']>$ttJmlBeli['pria']['hpBeli']) ){ + $jmlSisaJthpria = $ttJmlBeli['pria']['jml']-$ttJmlBeli['pria']['jmlRev']; + $hpSisaJthpria = $ttJmlBeli['pria']['hp']-$ttJmlBeli['pria']['hpRev']; + }else{ + $jmlSisaJthpria = $ttJmlBeli['pria']['jml']-$ttJmlBeli['pria']['jmlBeli']; + $hpSisaJthpria = $ttJmlBeli['pria']['hp']-$ttJmlBeli['pria']['hpBeli']; + } + print(""); + +// WANITA ------------------------------------------------------------------------- + if($ttJmlBeli['wanita']['jml']!=0 OR $ttJmlBeli['wanita']['jmlRev']!=0){ + print(""); + for($i=0;$i<$wanita;$i++){ + if ($str[$i-1]['wanita']==$str[$i]['wanita'] AND !empty($str[$i]['wanita'])){ + if ($str[$i-1]['wanita']==$str[$i]['wanita'] AND empty($strOrd[$i]['wanita'])){ + print(""); + }else{ + print(""); + } + + }else if ($str[$i-1]['wanita']==$str[$i]['wanita'] AND empty($str[$i]['wanita'])){ + if ($strOrd[$i-1]['wanita']==$strOrd[$i]['wanita']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlahD = 0; + $temphpD = 0; + $tempjumlahE = 0; + $temphpE = 0; + $tempjumlahF = 0; + $temphpF = 0; + } + + }else{ + if (empty($strOrd[$i]['wanita'])){ + print(""); + print(""); + }else if ($str[$i-1]['wanita']!=$str[$i]['wanita'] AND empty($str[$i]['wanita'])){ + $tempjswanita = 0; + $temprpwanita = 0; + print(""); + print(""); + }else{ + print(""); + print(""); + } + $tempjumlahD = 0; + $temphpD = 0; + $tempjumlahE = 0; + $temphpE = 0; + $tempjumlahF = 0; + $temphpF = 0; + } + $tempjumlahD += $jmlren[$i]['wanita']; + $temphpD += $rpren[$i]['wanita']; + $tempjumlahE += $jmlrev[$i]['wanita']; + $temphpE += $rprev[$i]['wanita']; + $tempjumlahF += $jmlBeli[$i]['wanita']; + $temphpF += $rpBeli[$i]['wanita']; + $tempjswanita += ($jmlren[$i]['wanita']-$jmlrev[$i]['wanita']); + $temprpwanita += ($rpren[$i]['wanita']-$rprev[$i]['wanita']); + + } + print(""); + } + print(""); + if( ($ttJmlBeli['wanita']['jmlRev']>$ttJmlBeli['wanita']['jmlBeli']) OR ($ttJmlBeli['wanita']['hpRev']>$ttJmlBeli['wanita']['hpBeli']) ){ + $jmlSisaJthwanita = $ttJmlBeli['wanita']['jml']-$ttJmlBeli['wanita']['jmlRev']; + $hpSisaJthwanita = $ttJmlBeli['wanita']['hp']-$ttJmlBeli['wanita']['hpRev']; + }else{ + $jmlSisaJthwanita = $ttJmlBeli['wanita']['jml']-$ttJmlBeli['wanita']['jmlBeli']; + $hpSisaJthwanita = $ttJmlBeli['wanita']['hp']-$ttJmlBeli['wanita']['hpBeli']; + } + print(""); +// ANAK ------------------------------------------------------------------------- + if($ttJmlBeli['anak']['jml']!=0 OR $ttJmlBeli['anak']['jmlRev']!=0){ + print(""); + for($i=0;$i<$anak;$i++){ + if ($str[$i-1]['anak']==$str[$i]['anak'] AND !empty($str[$i]['anak'])){ + if ($str[$i-1]['anak']==$str[$i]['anak'] AND empty($strOrd[$i]['anak'])){ + print(""); + }else{ + print(""); + } + + }else if ($str[$i-1]['anak']==$str[$i]['anak'] AND empty($str[$i]['anak'])){ + if ($strOrd[$i-1]['anak']==$strOrd[$i]['anak']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlahG = 0; + $temphpG = 0; + $tempjumlahH = 0; + $temphpH = 0; + $tempjumlahI = 0; + $temphpI = 0; + } + + }else{ + if (empty($strOrd[$i]['anak'])){ + print(""); + print(""); + }else if ($str[$i-1]['anak']!=$str[$i]['anak'] AND empty($str[$i]['anak'])){ + $tempjsanak = 0; + $temprpanak = 0; + print(""); + print(""); + }else{ + print(""); + print(""); + } + $tempjumlahG = 0; + $temphpG = 0; + $tempjumlahH = 0; + $temphpH = 0; + $tempjumlahI = 0; + $temphpI = 0; + } + $tempjumlahG += $jmlren[$i]['anak']; + $temphpG += $rpren[$i]['anak']; + $tempjumlahH += $jmlrev[$i]['anak']; + $temphpH += $rprev[$i]['anak']; + $tempjumlahI += $jmlBeli[$i]['anak']; + $temphpI += $rpBeli[$i]['anak']; + $tempjsanak += ($jmlren[$i]['anak']-$jmlrev[$i]['anak']); + $temprpanak += ($rpren[$i]['anak']-$rprev[$i]['anak']); + + } + print(""); + } + print(""); + if( ($ttJmlBeli['anak']['jmlRev']>$ttJmlBeli['anak']['jmlBeli']) OR ($ttJmlBeli['anak']['hpRev']>$ttJmlBeli['anak']['hpBeli']) ){ + $jmlSisaJthanak = $ttJmlBeli['anak']['jml']-$ttJmlBeli['anak']['jmlRev']; + $hpSisaJthanak = $ttJmlBeli['anak']['hp']-$ttJmlBeli['anak']['hpRev']; + }else{ + $jmlSisaJthanak = $ttJmlBeli['anak']['jml']-$ttJmlBeli['anak']['jmlBeli']; + $hpSisaJthanak = $ttJmlBeli['anak']['hp']-$ttJmlBeli['anak']['hpBeli']; + } + print(""); +// SEPATU ------------------------------------------------------------------------- + if($ttJmlBeli['sepatu']['jml']!=0 OR $ttJmlBeli['sepatu']['jmlRev']!=0){ + print(""); + for($i=0;$i<$sepatu;$i++){ + if ($str[$i-1]['sepatu']==$str[$i]['sepatu'] AND !empty($str[$i]['sepatu'])){ + if ($str[$i-1]['sepatu']==$str[$i]['sepatu'] AND empty($strOrd[$i]['sepatu'])){ + print(""); + }else{ + print(""); + } + + }else if ($str[$i-1]['sepatu']==$str[$i]['sepatu'] AND empty($str[$i]['sepatu'])){ + if ($strOrd[$i-1]['sepatu']==$strOrd[$i]['sepatu']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlahJ = 0; + $temphpJ = 0; + $tempjumlahK = 0; + $temphpK = 0; + $tempjumlahL = 0; + $temphpL = 0; + } + + }else{ + if (empty($strOrd[$i]['sepatu'])){ + print(""); + print(""); + }else if ($str[$i-1]['sepatu']!=$str[$i]['sepatu'] AND empty($str[$i]['sepatu'])){ + $tempjssepatu = 0; + $temprpsepatu = 0; + print(""); + print(""); + }else{ + print(""); + print(""); + } + $tempjumlahJ = 0; + $temphpJ = 0; + $tempjumlahK = 0; + $temphpK = 0; + $tempjumlahL = 0; + $temphpL = 0; + } + $tempjumlahJ += $jmlren[$i]['sepatu']; + $temphpJ += $rpren[$i]['sepatu']; + $tempjumlahK += $jmlrev[$i]['sepatu']; + $temphpK += $rprev[$i]['sepatu']; + $tempjumlahL += $jmlBeli[$i]['sepatu']; + $temphpL += $rpBeli[$i]['sepatu']; + $tempjssepatu += ($jmlren[$i]['sepatu']-$jmlrev[$i]['sepatu']); + $temprpsepatu += ($rpren[$i]['sepatu']-$rprev[$i]['sepatu']); + + } + print(""); + } + print(""); + if( ($ttJmlBeli['sepatu']['jmlRev']>$ttJmlBeli['sepatu']['jmlBeli']) OR ($ttJmlBeli['sepatu']['hpRev']>$ttJmlBeli['sepatu']['hpBeli']) ){ + $jmlSisaJthsepatu = $ttJmlBeli['sepatu']['jml']-$ttJmlBeli['sepatu']['jmlRev']; + $hpSisaJthsepatu = $ttJmlBeli['sepatu']['hp']-$ttJmlBeli['sepatu']['hpRev']; + }else{ + $jmlSisaJthsepatu = $ttJmlBeli['sepatu']['jml']-$ttJmlBeli['sepatu']['jmlBeli']; + $hpSisaJthsepatu = $ttJmlBeli['sepatu']['hp']-$ttJmlBeli['sepatu']['hpBeli']; + } + print(""); + + $ttjml1 = $ttJmlBeli['pria']['jml'] + $ttJmlBeli['wanita']['jml'] + $ttJmlBeli['anak']['jml'] + $ttJmlBeli['sepatu']['jml']; + $ttrp1 = $ttJmlBeli['pria']['hp'] + $ttJmlBeli['wanita']['hp'] + $ttJmlBeli['anak']['hp'] + $ttJmlBeli['sepatu']['hp']; + $ttjml2 = $ttJmlBeli['pria']['jmlRev'] + $ttJmlBeli['wanita']['jmlRev'] + $ttJmlBeli['anak']['jmlRev'] + $ttJmlBeli['sepatu']['jmlRev']; + $ttrp2 = $ttJmlBeli['pria']['hpRev'] + $ttJmlBeli['wanita']['hpRev'] + $ttJmlBeli['anak']['hpRev'] + $ttJmlBeli['sepatu']['hpRev']; + $ttjselisih = $tempjspria + $tempjswanita + $tempjsanak + $tempjssepatu; + $ttrpselisih = $temprppria + $temprpwanita + $temprpanak + $temprpsepatu; + + print(" + + + + "); + + print("
KategoriLiniKode SuppNama SuppJml RencTotHP Renc Kode SuppNama SuppJml OrderTotHP Order Kode SuppNama SuppJml BeliTotHP Beli Jml PenyimpanganTotHP Penyimpangan
Pria
~".$str[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")." .".$kdSuppOrd[$i]['pria']."".$nmSuppOrd[$i]['pria']."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")." .".$kdSuppBeli[$i]['pria']."".$nmSuppBeli[$i]['pria']."".number_format($jmlBeli[$i]['pria'], 0, ",", ".")."".number_format($rpBeli[$i]['pria'], 0, ",", ".")."
~".$str[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")." .".$kdSuppOrd[$i]['pria']."".$nmSuppOrd[$i]['pria']."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")." .".$kdSuppBeli[$i]['pria']."".$nmSuppBeli[$i]['pria']."".number_format($jmlBeli[$i]['pria'], 0, ",", ".")."".number_format($rpBeli[$i]['pria'], 0, ",", ".")." ".number_format($jmlren[$i]['pria']-$jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria']-$rprev[$i]['pria'], 0, ",", ".")."
~".$strOrd[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")." .".$kdSuppOrd[$i]['pria']."".$nmSuppOrd[$i]['pria']."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")." .".$kdSuppBeli[$i]['pria']."".$nmSuppBeli[$i]['pria']."".number_format($jmlBeli[$i]['pria'], 0, ",", ".")."".number_format($rpBeli[$i]['pria'], 0, ",", ".")." ".number_format($jmlren[$i]['pria']-$jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria']-$rprev[$i]['pria'], 0, ",", ".")."
".number_format($tempjumlahA, 0, ",", ".")."".number_format($temphpA, 0, ",", ".")." ".number_format($tempjumlahB, 0, ",", ".")."".number_format($temphpB, 0, ",", ".")." ".number_format($tempjumlahC, 0, ",", ".")."".number_format($temphpC, 0, ",", ".")." ".number_format($tempjumlahA-$tempjumlahB, 0, ",", ".")."".number_format($temphpA-$temphpB, 0, ",", ".")."
~".$strOrd[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")." .".$kdSuppOrd[$i]['pria']."".$nmSuppOrd[$i]['pria']."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")." .".$kdSuppBeli[$i]['pria']."".$nmSuppBeli[$i]['pria']."".number_format($jmlBeli[$i]['pria'], 0, ",", ".")."".number_format($rpBeli[$i]['pria'], 0, ",", ".")." ".number_format($jmlren[$i]['pria']-$jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria']-$rprev[$i]['pria'], 0, ",", ".")."
".number_format($tempjumlahA, 0, ",", ".")."".number_format($temphpA, 0, ",", ".")." ".number_format($tempjumlahB, 0, ",", ".")."".number_format($temphpB, 0, ",", ".")." ".number_format($tempjumlahC, 0, ",", ".")."".number_format($temphpC, 0, ",", ".")."
~".$str[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")." .".$kdSuppOrd[$i]['pria']."".$nmSuppOrd[$i]['pria']."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")." .".$kdSuppBeli[$i]['pria']."".$nmSuppBeli[$i]['pria']."".number_format($jmlBeli[$i]['pria'], 0, ",", ".")."".number_format($rpBeli[$i]['pria'], 0, ",", ".")."
".number_format($tempjumlahA, 0, ",", ".")."".number_format($temphpA, 0, ",", ".")." ".number_format($tempjumlahB, 0, ",", ".")."".number_format($temphpB, 0, ",", ".")." ".number_format($tempjumlahC, 0, ",", ".")."".number_format($temphpC, 0, ",", ".")."
~".$strOrd[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")." .".$kdSuppOrd[$i]['pria']."".$nmSuppOrd[$i]['pria']."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")." .".$kdSuppBeli[$i]['pria']."".$nmSuppBeli[$i]['pria']."".number_format($jmlBeli[$i]['pria'], 0, ",", ".")."".number_format($rpBeli[$i]['pria'], 0, ",", ".")." ".number_format($jmlren[$i]['pria']-$jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria']-$rprev[$i]['pria'], 0, ",", ".")."
".number_format($tempjumlahA, 0, ",", ".")."".number_format($temphpA, 0, ",", ".")." ".number_format($tempjumlahB, 0, ",", ".")."".number_format($temphpB, 0, ",", ".")." ".number_format($tempjumlahC, 0, ",", ".")."".number_format($temphpC, 0, ",", ".")." ".number_format($tempjumlahA-$tempjumlahB, 0, ",", ".")."".number_format($temphpA-$temphpB, 0, ",", ".")."
~".$str[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")." .".$kdSuppOrd[$i]['pria']."".$nmSuppOrd[$i]['pria']."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")." .".$kdSuppBeli[$i]['pria']."".$nmSuppBeli[$i]['pria']."".number_format($jmlBeli[$i]['pria'], 0, ",", ".")."".number_format($rpBeli[$i]['pria'], 0, ",", ".")." ".number_format($jmlren[$i]['pria']-$jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria']-$rprev[$i]['pria'], 0, ",", ".")."
".number_format($tempjumlahA, 0, ",", ".")."".number_format($temphpA, 0, ",", ".")." ".number_format($tempjumlahB, 0, ",", ".")."".number_format($temphpB, 0, ",", ".")." ".number_format($tempjumlahC, 0, ",", ".")."".number_format($temphpC, 0, ",", ".")." ".number_format($tempjumlahA-$tempjumlahB, 0, ",", ".")."".number_format($temphpA-$temphpB, 0, ",", ".")."
TOTAL Pria".number_format($ttJmlBeli['pria']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['hp'], 0, ",", ".")." ".number_format($ttJmlBeli['pria']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['hpRev'], 0, ",", ".")." ".number_format($ttJmlBeli['pria']['jmlBeli'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['hpBeli'], 0, ",", ".")." ".number_format($tempjspria, 0, ",", ".")."".number_format($temprppria, 0, ",", ".")."
SISA JATAH".number_format($jmlSisaJthpria, 0, ",", ".")." ".number_format($hpSisaJthpria, 0, ",", ".")."
Wanita
~".$str[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")." .".$kdSuppOrd[$i]['wanita']."".$nmSuppOrd[$i]['wanita']."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")." .".$kdSuppBeli[$i]['wanita']."".$nmSuppBeli[$i]['wanita']."".number_format($jmlBeli[$i]['wanita'], 0, ",", ".")."".number_format($rpBeli[$i]['wanita'], 0, ",", ".")."
~".$str[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")." .".$kdSuppOrd[$i]['wanita']."".$nmSuppOrd[$i]['wanita']."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")." .".$kdSuppBeli[$i]['wanita']."".$nmSuppBeli[$i]['wanita']."".number_format($jmlBeli[$i]['wanita'], 0, ",", ".")."".number_format($rpBeli[$i]['wanita'], 0, ",", ".")." ".number_format($jmlren[$i]['wanita']-$jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita']-$rprev[$i]['wanita'], 0, ",", ".")."
~".$strOrd[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")." .".$kdSuppOrd[$i]['wanita']."".$nmSuppOrd[$i]['wanita']."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")." .".$kdSuppBeli[$i]['wanita']."".$nmSuppBeli[$i]['wanita']."".number_format($jmlBeli[$i]['wanita'], 0, ",", ".")."".number_format($rpBeli[$i]['wanita'], 0, ",", ".")." ".number_format($jmlren[$i]['wanita']-$jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita']-$rprev[$i]['wanita'], 0, ",", ".")."
".number_format($tempjumlahD, 0, ",", ".")."".number_format($temphpD, 0, ",", ".")." ".number_format($tempjumlahE, 0, ",", ".")."".number_format($temphpE, 0, ",", ".")." ".number_format($tempjumlahF, 0, ",", ".")."".number_format($temphpF, 0, ",", ".")." ".number_format($tempjumlahD-$tempjumlahE, 0, ",", ".")."".number_format($temphpD-$temphpE, 0, ",", ".")."
~".$strOrd[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")." .".$kdSuppOrd[$i]['wanita']."".$nmSuppOrd[$i]['wanita']."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")." .".$kdSuppBeli[$i]['wanita']."".$nmSuppBeli[$i]['wanita']."".number_format($jmlBeli[$i]['wanita'], 0, ",", ".")."".number_format($rpBeli[$i]['wanita'], 0, ",", ".")." ".number_format($jmlren[$i]['wanita']-$jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita']-$rprev[$i]['wanita'], 0, ",", ".")."
".number_format($tempjumlahD, 0, ",", ".")."".number_format($temphpD, 0, ",", ".")." ".number_format($tempjumlahE, 0, ",", ".")."".number_format($temphpE, 0, ",", ".")." ".number_format($tempjumlahF, 0, ",", ".")."".number_format($temphpF, 0, ",", ".")."
~".$str[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")." .".$kdSuppOrd[$i]['wanita']."".$nmSuppOrd[$i]['wanita']."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")." .".$kdSuppBeli[$i]['wanita']."".$nmSuppBeli[$i]['wanita']."".number_format($jmlBeli[$i]['wanita'], 0, ",", ".")."".number_format($rpBeli[$i]['wanita'], 0, ",", ".")."
".number_format($tempjumlahD, 0, ",", ".")."".number_format($temphpD, 0, ",", ".")." ".number_format($tempjumlahE, 0, ",", ".")."".number_format($temphpE, 0, ",", ".")." ".number_format($tempjumlahF, 0, ",", ".")."".number_format($temphpF, 0, ",", ".")."
~".$strOrd[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")." .".$kdSuppOrd[$i]['wanita']."".$nmSuppOrd[$i]['wanita']."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")." .".$kdSuppBeli[$i]['wanita']."".$nmSuppBeli[$i]['wanita']."".number_format($jmlBeli[$i]['wanita'], 0, ",", ".")."".number_format($rpBeli[$i]['wanita'], 0, ",", ".")." ".number_format($jmlren[$i]['wanita']-$jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita']-$rprev[$i]['wanita'], 0, ",", ".")."
".number_format($tempjumlahD, 0, ",", ".")."".number_format($temphpD, 0, ",", ".")." ".number_format($tempjumlahE, 0, ",", ".")."".number_format($temphpE, 0, ",", ".")." ".number_format($tempjumlahF, 0, ",", ".")."".number_format($temphpF, 0, ",", ".")." ".number_format($tempjumlahD-$tempjumlahE, 0, ",", ".")."".number_format($temphpD-$temphpE, 0, ",", ".")."
~".$str[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")." .".$kdSuppOrd[$i]['wanita']."".$nmSuppOrd[$i]['wanita']."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")." .".$kdSuppBeli[$i]['wanita']."".$nmSuppBeli[$i]['wanita']."".number_format($jmlBeli[$i]['wanita'], 0, ",", ".")."".number_format($rpBeli[$i]['wanita'], 0, ",", ".")." ".number_format($jmlren[$i]['wanita']-$jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita']-$rprev[$i]['wanita'], 0, ",", ".")."
".number_format($tempjumlahD, 0, ",", ".")."".number_format($temphpD, 0, ",", ".")." ".number_format($tempjumlahE, 0, ",", ".")."".number_format($temphpE, 0, ",", ".")." ".number_format($tempjumlahF, 0, ",", ".")."".number_format($temphpF, 0, ",", ".")." ".number_format($tempjumlahD-$tempjumlahE, 0, ",", ".")."".number_format($temphpD-$temphpE, 0, ",", ".")."
TOTAL Wanita".number_format($ttJmlBeli['wanita']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['hp'], 0, ",", ".")." ".number_format($ttJmlBeli['wanita']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['hpRev'], 0, ",", ".")." ".number_format($ttJmlBeli['wanita']['jmlBeli'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['hpBeli'], 0, ",", ".")." ".number_format($tempjswanita, 0, ",", ".")."".number_format($temprpwanita, 0, ",", ".")."
SISA JATAH".number_format($jmlSisaJthwanita, 0, ",", ".")." ".number_format($hpSisaJthwanita, 0, ",", ".")."
Anak
~".$str[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")." .".$kdSuppOrd[$i]['anak']."".$nmSuppOrd[$i]['anak']."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")." .".$kdSuppBeli[$i]['anak']."".$nmSuppBeli[$i]['anak']."".number_format($jmlBeli[$i]['anak'], 0, ",", ".")."".number_format($rpBeli[$i]['anak'], 0, ",", ".")."
~".$str[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")." .".$kdSuppOrd[$i]['anak']."".$nmSuppOrd[$i]['anak']."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")." .".$kdSuppBeli[$i]['anak']."".$nmSuppBeli[$i]['anak']."".number_format($jmlBeli[$i]['anak'], 0, ",", ".")."".number_format($rpBeli[$i]['anak'], 0, ",", ".")." ".number_format($jmlren[$i]['anak']-$jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak']-$rprev[$i]['anak'], 0, ",", ".")."
~".$strOrd[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")." .".$kdSuppOrd[$i]['anak']."".$nmSuppOrd[$i]['anak']."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")." .".$kdSuppBeli[$i]['anak']."".$nmSuppBeli[$i]['anak']."".number_format($jmlBeli[$i]['anak'], 0, ",", ".")."".number_format($rpBeli[$i]['anak'], 0, ",", ".")." ".number_format($jmlren[$i]['anak']-$jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak']-$rprev[$i]['anak'], 0, ",", ".")."
".number_format($tempjumlahG, 0, ",", ".")."".number_format($temphpG, 0, ",", ".")." ".number_format($tempjumlahH, 0, ",", ".")."".number_format($temphpH, 0, ",", ".")." ".number_format($tempjumlahI, 0, ",", ".")."".number_format($temphpI, 0, ",", ".")." ".number_format($tempjumlahG-$tempjumlahH, 0, ",", ".")."".number_format($temphpG-$temphpH, 0, ",", ".")."
~".$strOrd[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")." .".$kdSuppOrd[$i]['anak']."".$nmSuppOrd[$i]['anak']."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")." .".$kdSuppBeli[$i]['anak']."".$nmSuppBeli[$i]['anak']."".number_format($jmlBeli[$i]['anak'], 0, ",", ".")."".number_format($rpBeli[$i]['anak'], 0, ",", ".")." ".number_format($jmlren[$i]['anak']-$jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak']-$rprev[$i]['anak'], 0, ",", ".")."
".number_format($tempjumlahG, 0, ",", ".")."".number_format($temphpG, 0, ",", ".")." ".number_format($tempjumlahH, 0, ",", ".")."".number_format($temphpH, 0, ",", ".")." ".number_format($tempjumlahI, 0, ",", ".")."".number_format($temphpI, 0, ",", ".")."
~".$str[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")." .".$kdSuppOrd[$i]['anak']."".$nmSuppOrd[$i]['anak']."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")." .".$kdSuppBeli[$i]['anak']."".$nmSuppBeli[$i]['anak']."".number_format($jmlBeli[$i]['anak'], 0, ",", ".")."".number_format($rpBeli[$i]['anak'], 0, ",", ".")."
".number_format($tempjumlahG, 0, ",", ".")."".number_format($temphpG, 0, ",", ".")." ".number_format($tempjumlahH, 0, ",", ".")."".number_format($temphpH, 0, ",", ".")." ".number_format($tempjumlahI, 0, ",", ".")."".number_format($temphpI, 0, ",", ".")."
~".$strOrd[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")." .".$kdSuppOrd[$i]['anak']."".$nmSuppOrd[$i]['anak']."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")." .".$kdSuppBeli[$i]['anak']."".$nmSuppBeli[$i]['anak']."".number_format($jmlBeli[$i]['anak'], 0, ",", ".")."".number_format($rpBeli[$i]['anak'], 0, ",", ".")." ".number_format($jmlren[$i]['anak']-$jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak']-$rprev[$i]['anak'], 0, ",", ".")."
".number_format($tempjumlahG, 0, ",", ".")."".number_format($temphpG, 0, ",", ".")." ".number_format($tempjumlahH, 0, ",", ".")."".number_format($temphpH, 0, ",", ".")." ".number_format($tempjumlahI, 0, ",", ".")."".number_format($temphpI, 0, ",", ".")." ".number_format($tempjumlahG-$tempjumlahH, 0, ",", ".")."".number_format($temphpG-$temphpH, 0, ",", ".")."
~".$str[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")." .".$kdSuppOrd[$i]['anak']."".$nmSuppOrd[$i]['anak']."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")." .".$kdSuppBeli[$i]['anak']."".$nmSuppBeli[$i]['anak']."".number_format($jmlBeli[$i]['anak'], 0, ",", ".")."".number_format($rpBeli[$i]['anak'], 0, ",", ".")." ".number_format($jmlren[$i]['anak']-$jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak']-$rprev[$i]['anak'], 0, ",", ".")."
".number_format($tempjumlahG, 0, ",", ".")."".number_format($temphpG, 0, ",", ".")." ".number_format($tempjumlahH, 0, ",", ".")."".number_format($temphpH, 0, ",", ".")." ".number_format($tempjumlahI, 0, ",", ".")."".number_format($temphpI, 0, ",", ".")." ".number_format($tempjumlahG-$tempjumlahH, 0, ",", ".")."".number_format($temphpG-$temphpH, 0, ",", ".")."
TOTAL Anak".number_format($ttJmlBeli['anak']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['hp'], 0, ",", ".")." ".number_format($ttJmlBeli['anak']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['hpRev'], 0, ",", ".")." ".number_format($ttJmlBeli['anak']['jmlBeli'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['hpBeli'], 0, ",", ".")." ".number_format($tempjsanak, 0, ",", ".")."".number_format($temprpanak, 0, ",", ".")."
SISA JATAH".number_format($jmlSisaJthanak, 0, ",", ".")." ".number_format($hpSisaJthanak, 0, ",", ".")."
Sepatu
~".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlren[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu'], 0, ",", ".")." .".$kdSuppOrd[$i]['sepatu']."".$nmSuppOrd[$i]['sepatu']."".number_format($jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rprev[$i]['sepatu'], 0, ",", ".")." .".$kdSuppBeli[$i]['sepatu']."".$nmSuppBeli[$i]['sepatu']."".number_format($jmlBeli[$i]['sepatu'], 0, ",", ".")."".number_format($rpBeli[$i]['sepatu'], 0, ",", ".")."
~".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlren[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu'], 0, ",", ".")." .".$kdSuppOrd[$i]['sepatu']."".$nmSuppOrd[$i]['sepatu']."".number_format($jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rprev[$i]['sepatu'], 0, ",", ".")." .".$kdSuppBeli[$i]['sepatu']."".$nmSuppBeli[$i]['sepatu']."".number_format($jmlBeli[$i]['sepatu'], 0, ",", ".")."".number_format($rpBeli[$i]['sepatu'], 0, ",", ".")." ".number_format($jmlren[$i]['sepatu']-$jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu']-$rprev[$i]['sepatu'], 0, ",", ".")."
~".$strOrd[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlren[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu'], 0, ",", ".")." .".$kdSuppOrd[$i]['sepatu']."".$nmSuppOrd[$i]['sepatu']."".number_format($jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rprev[$i]['sepatu'], 0, ",", ".")." .".$kdSuppBeli[$i]['sepatu']."".$nmSuppBeli[$i]['sepatu']."".number_format($jmlBeli[$i]['sepatu'], 0, ",", ".")."".number_format($rpBeli[$i]['sepatu'], 0, ",", ".")." ".number_format($jmlren[$i]['sepatu']-$jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu']-$rprev[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlahJ, 0, ",", ".")."".number_format($temphpJ, 0, ",", ".")." ".number_format($tempjumlahK, 0, ",", ".")."".number_format($temphpK, 0, ",", ".")." ".number_format($tempjumlahL, 0, ",", ".")."".number_format($temphpL, 0, ",", ".")." ".number_format($tempjumlahJ-$tempjumlahK, 0, ",", ".")."".number_format($temphpJ-$temphpK, 0, ",", ".")."
~".$strOrd[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlren[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu'], 0, ",", ".")." .".$kdSuppOrd[$i]['sepatu']."".$nmSuppOrd[$i]['sepatu']."".number_format($jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rprev[$i]['sepatu'], 0, ",", ".")." .".$kdSuppBeli[$i]['sepatu']."".$nmSuppBeli[$i]['sepatu']."".number_format($jmlBeli[$i]['sepatu'], 0, ",", ".")."".number_format($rpBeli[$i]['sepatu'], 0, ",", ".")." ".number_format($jmlren[$i]['sepatu']-$jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu']-$rprev[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlahJ, 0, ",", ".")."".number_format($temphpJ, 0, ",", ".")." ".number_format($tempjumlahK, 0, ",", ".")."".number_format($temphpK, 0, ",", ".")." ".number_format($tempjumlahL, 0, ",", ".")."".number_format($temphpL, 0, ",", ".")."
~".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlren[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu'], 0, ",", ".")." .".$kdSuppOrd[$i]['sepatu']."".$nmSuppOrd[$i]['sepatu']."".number_format($jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rprev[$i]['sepatu'], 0, ",", ".")." .".$kdSuppBeli[$i]['sepatu']."".$nmSuppBeli[$i]['sepatu']."".number_format($jmlBeli[$i]['sepatu'], 0, ",", ".")."".number_format($rpBeli[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlahJ, 0, ",", ".")."".number_format($temphpJ, 0, ",", ".")." ".number_format($tempjumlahK, 0, ",", ".")."".number_format($temphpK, 0, ",", ".")." ".number_format($tempjumlahL, 0, ",", ".")."".number_format($temphpL, 0, ",", ".")."
~".$strOrd[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlren[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu'], 0, ",", ".")." .".$kdSuppOrd[$i]['sepatu']."".$nmSuppOrd[$i]['sepatu']."".number_format($jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rprev[$i]['sepatu'], 0, ",", ".")." .".$kdSuppBeli[$i]['sepatu']."".$nmSuppBeli[$i]['sepatu']."".number_format($jmlBeli[$i]['sepatu'], 0, ",", ".")."".number_format($rpBeli[$i]['sepatu'], 0, ",", ".")." ".number_format($jmlren[$i]['sepatu']-$jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu']-$rprev[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlahJ, 0, ",", ".")."".number_format($temphpJ, 0, ",", ".")." ".number_format($tempjumlahK, 0, ",", ".")."".number_format($temphpK, 0, ",", ".")." ".number_format($tempjumlahL, 0, ",", ".")."".number_format($temphpL, 0, ",", ".")." ".number_format($tempjumlahJ-$tempjumlahK, 0, ",", ".")."".number_format($temphpJ-$temphpK, 0, ",", ".")."
~".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlren[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu'], 0, ",", ".")." .".$kdSuppOrd[$i]['sepatu']."".$nmSuppOrd[$i]['sepatu']."".number_format($jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rprev[$i]['sepatu'], 0, ",", ".")." .".$kdSuppBeli[$i]['sepatu']."".$nmSuppBeli[$i]['sepatu']."".number_format($jmlBeli[$i]['sepatu'], 0, ",", ".")."".number_format($rpBeli[$i]['sepatu'], 0, ",", ".")." ".number_format($jmlren[$i]['sepatu']-$jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu']-$rprev[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlahJ, 0, ",", ".")."".number_format($temphpJ, 0, ",", ".")." ".number_format($tempjumlahK, 0, ",", ".")."".number_format($temphpK, 0, ",", ".")." ".number_format($tempjumlahL, 0, ",", ".")."".number_format($temphpL, 0, ",", ".")." ".number_format($tempjumlahJ-$tempjumlahK, 0, ",", ".")."".number_format($temphpJ-$temphpK, 0, ",", ".")."
TOTAL Sepatu".number_format($ttJmlBeli['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp'], 0, ",", ".")." ".number_format($ttJmlBeli['sepatu']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hpRev'], 0, ",", ".")." ".number_format($ttJmlBeli['sepatu']['jmlBeli'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hpBeli'], 0, ",", ".")." ".number_format($tempjssepatu, 0, ",", ".")."".number_format($temprpsepatu, 0, ",", ".")."
SISA JATAH".number_format($jmlSisaJthsepatu, 0, ",", ".")." ".number_format($hpSisaJthsepatu, 0, ",", ".")."
T O T A L : ".number_format($ttjml1, 0, ",", ".")."".number_format($ttrp1, 0, ",", ".")."".number_format($ttjml2, 0, ",", ".")."".number_format($ttrp2, 0, ",", ".")."".number_format($ttjselisih, 0, ",", ".")."".number_format($ttrpselisih, 0, ",", ".")."

"); + }else{ + echo "Tidak ada data untuk tanggal tersebut!"; + } + } + + } +?> diff --git a/old-source/LaporanBeli/lapbelidlmpdk.php b/old-source/LaporanBeli/lapbelidlmpdk.php new file mode 100644 index 0000000..b1767c5 --- /dev/null +++ b/old-source/LaporanBeli/lapbelidlmpdk.php @@ -0,0 +1,249 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:700px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + + if(bukaKoneksi()){ + global $conn; + + $query = "SELECT s.kel_jns,s.nama_strip,k.ked_produk, + sum( d.jum_fisik) jum, + sum(d.jum_fisik*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + FROM d_pembelian d, m_pembelian m, strip s,kedalaman_produk k, barang b + WHERE d.no_faktur = m.no_faktur + AND b.kode_barang = d.kode_barang + AND s.kd_strip = b.kode_strip + AND (b.kode_strip = k.kode_strip and b.ked_produk = k.kode_ked_produk) + AND m.tgl_masuk BETWEEN '$startDate' AND '$endDate' + AND m.validasi = '1' + AND m.status_revisi = '1' + GROUP BY b.kode_strip,b.ked_produk"; + + $query2 ="SELECT s.kel_jns,s.nama_strip,k.ked_produk, + sum( d.jumlah ) jum,sum(d.jumlah*d.harga_satuan) hp + FROM d_retur_beli d, m_retur_beli m, kedalaman_produk k,strip s, barang b + WHERE d.id_retur = m.id_retur + AND b.kode_barang = d.kd_barang + AND s.kd_strip = b.kode_strip + AND (b.kode_strip = k.kode_strip and b.ked_produk = k.kode_ked_produk) + AND m.tgl_retur BETWEEN '$startDate' AND '$endDate' + AND m.validasi = '1' + GROUP BY b.kode_strip,b.ked_produk"; + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cekR = mysqli_stmt_num_rows($stmt2); + if($cekR >= 0){//jika ada retur + mysqli_stmt_bind_result($stmt2,$kel,$str,$kdsup,$jmlRetur,$rpRetur); + + $priaR = 0; + $wanitaR = 0; + $anakR = 0; + $sepatuR = 0; + $strRet = array(); + $jmlR = array(); + $rpR = array(); + + $ttJmlRetur = array(); + $ttJmlRetur['pria']['jml'] = 0; + $ttJmlRetur['pria']['rp'] = 0; + $ttJmlRetur['wanita']['jml'] = 0; + $ttJmlRetur['wanita']['rp'] = 0; + $ttJmlRetur['anak']['jml'] = 0; + $ttJmlRetur['anak']['rp'] = 0; + $ttJmlRetur['sepatu']['jml'] = 0; + $ttJmlRetur['sepatu']['rp'] = 0; + + + while(mysqli_stmt_fetch($stmt2)){ + if($kel == 'P'){ + $strRet[$priaR]['pria'] = $str; + $jmlR[$priaR]['pria'] = $jmlRetur; + $rpR[$priaR]['pria'] = $rpRetur; + $ttJmlRetur['pria']['jml'] += $jmlRetur; + $ttJmlRetur['pria']['rp'] += $rpRetur; + $kdSupplier[$priaR]['pria'] = $kdsup; + $nmSupplier[$priaR]['pria'] = $nmsup; + $priaR++; + }elseif($kel == 'W'){ + $strRet[$wanitaR]['wanita'] = $str; + $jmlR[$wanitaR]['wanita'] = $jmlRetur; + $rpR[$wanitaR]['wanita'] = $rpRetur; + $ttJmlRetur['wanita']['jml'] += $jmlRetur; + $ttJmlRetur['wanita']['rp'] += $rpRetur; + $kdSupplier[$wanitaR]['wanita'] = $kdsup; + $nmSupplier[$wanitaR]['wanita'] = $nmsup; + $wanitaR++; + }elseif($kel == 'A'){ + $strRet[$anakR]['anak'] = $str; + $jmlR[$anakR]['anak'] = $jmlRetur; + $rpR[$anakR]['anak'] = $rpRetur; + $ttJmlRetur['anak']['jml'] += $jmlRetur; + $ttJmlRetur['anak']['rp'] += $rpRetur; + $kdSupplier[$anakR]['anak'] = $kdsup; + $nmSupplier[$anakR]['anak'] = $nmsup; + $anakR++; + }else{ + $strRet[$sepatuR]['sepatu'] = $str; + $jmlR[$sepatuR]['sepatu'] = $jmlRetur; + $rpR[$sepatuR]['sepatu'] = $rpRetur; + $ttJmlRetur['sepatu']['jml'] += $jmlRetur; + $ttJmlRetur['sepatu']['rp'] += $rpRetur; + $kdSupplier[$sepatuR]['sepatu'] = $kdsup; + $nmSupplier[$sepatuR]['sepatu'] = $nmsup; + $sepatuR++; + } + } + + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_free_result($stmt2); + mysqli_stmt_close($stmt2); + } + } + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek >= 0){ + mysqli_stmt_bind_result($stmt,$kelJns,$strip,$kd,$jmlBeli,$hrgPokok); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + + print("
"); + print("

Laporan Pembelian Per Sub Group Product



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PADA TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $str = array(); + $jmlB = array(); + $rpB = array(); + $HP = array(); + + while(mysqli_stmt_fetch($stmt)){ + if($jmlRetur == ''){ + $jmlRetur = 0; + } + if($rpRetur == ''){ + $rpRetur = 0; + } + if($kelJns == "P"){ + $kelJns = "Pria"; + $ttJmlBeli['pria']['jml'] += $jmlBeli; + $ttJmlBeli['pria']['hp'] += $hrgPokok; + $str[$pria]['pria'] = $strip; + $jmlB[$pria]['pria'] = $jmlBeli; + $rpB[$pria]['pria'] = $rpBeli; + $HP[$pria]['pria'] = $hrgPokok; + $kdSupp[$pria]['pria'] = $kd; + $nmSupp[$pria]['pria'] = $nm; + $pria++; + }elseif($kelJns == "W"){ + $kelJns = "Wanita"; + $ttJmlBeli['wanita']['jml'] += $jmlBeli; + $ttJmlBeli['wanita']['hp'] += $hrgPokok; + $str[$wanita]['wanita'] = $strip; + $jmlB[$wanita]['wanita'] = $jmlBeli; + $rpB[$wanita]['wanita'] = $rpBeli; + $HP[$wanita]['wanita'] = $hrgPokok; + $kdSupp[$wanita]['wanita'] = $kd; + $nmSupp[$wanita]['wanita'] = $nm; + $wanita++; + }elseif($kelJns == "A"){ + $kelJns = "Anak"; + $ttJmlBeli['anak']['jml'] += $jmlBeli; + $ttJmlBeli['anak']['hp'] += $hrgPokok; + $str[$anak]['anak'] = $strip; + $jmlB[$anak]['anak'] = $jmlBeli; + $rpB[$anak]['anak'] = $rpBeli; + $HP[$anak]['anak'] = $hrgPokok; + $kdSupp[$anak]['anak'] = $kd; + $nmSupp[$anak]['anak'] = $nm; + $anak++; + }else{ + $kelJns = "Sepatu"; + $ttJmlBeli['sepatu']['jml'] += $jmlBeli; + $ttJmlBeli['sepatu']['hp'] += $hrgPokok; + $str[$sepatu]['sepatu'] = $strip; + $jmlB[$sepatu]['sepatu'] = $jmlBeli; + $rpB[$sepatu]['sepatu'] = $rpBeli; + $HP[$sepatu]['sepatu'] = $hrgPokok; + $kdSupp[$sepatu]['sepatu'] = $kd; + $nmSupp[$sepatu]['sepatu'] = $nm; + $sepatu++; + } + + } + print(""); + print(""); + print("
"); + +/* SEPATU -------------------------------------------------------------------------*/ + $jmlkatsepatu = $ttJmlBeli['sepatu']['jml']-$ttJmlRetur['sepatu']['jml']; + $hpkatsepatu = $ttJmlBeli['sepatu']['hp']-$ttJmlRetur['sepatu']['rp']; + + if($ttJmlBeli['sepatu']['jml']!=0){ + print("
"); + for($i=0;$i<$sepatu;$i++){ + print(""); + } + print(""); + } + + if($ttJmlRetur['sepatu']['jml']!= 0){ + print(""); + for($x=0;$x<$sepatuR;$x++){ + print(""); + } + print(""); + } + + print(""); + + $ttjml = $jmlkatpria + $jmlkatwanita + $jmlkatanak + $jmlkatsepatu; + $ttrp = $rpkatpria + $rpkatwanita + $rpkatanak + $rpkatsepatu; + $tthp = $hpkatpria + $hpkatwanita + $hpkatanak + $hpkatsepatu; + + print(" + + "); + + print("
Lini ProdukKedalaman Prod.Jumlah BeliTotal HP
".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($ttJmlBeli['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp'], 0, ",", ".")."
Data Retur
".$strRet[$x]['sepatu'].".".$kdSupplier[$x]['sepatu']."".number_format($jmlR[$x]['sepatu'], 0, ",", ".")."".number_format($rpR[$x]['sepatu'], 0, ",", ".")."
".number_format($ttJmlRetur['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['sepatu']['rp'], 0, ",", ".")."
Sub Total".number_format($jmlkatsepatu, 0, ",", ".")."".number_format($hpkatsepatu, 0, ",", ".")."
T O T A L : ".number_format($ttjml, 0, ",", ".")."".number_format($tthp, 0, ",", ".")."

"); + }else{ + echo "Belum ada data pembelian untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/lapbelidlmpdk.php~ b/old-source/LaporanBeli/lapbelidlmpdk.php~ new file mode 100644 index 0000000..1928860 --- /dev/null +++ b/old-source/LaporanBeli/lapbelidlmpdk.php~ @@ -0,0 +1,310 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:700px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + + if(bukaKoneksi()){ + global $conn; + + $query = "SELECT s.kel_jns,substr( d.kode_barang, 1, 2 ) kdBrg, + substr( d.kode_barang, 5, 1 ) dlmpdk,k.ked_produk, + sum( d.jumlah ) jum, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + FROM d_pembelian d, m_pembelian m, strip s,kedalaman_produk k + WHERE d.no_faktur = m.no_faktur + AND s.kd_strip = substr( d.kode_barang, 1, 2 ) + AND k.kode_strip = substr( d.kode_barang, 1, 2 ) + AND k.kode_ked_produk = substr( d.kode_barang, 5, 1 ) + AND m.tgl_masuk BETWEEN '$startDate' AND '$endDate' AND m.validasi = '1' + GROUP BY substr( d.kode_barang, 1, 2 ),substr( d.kode_barang, 5, 1 )"; + $query2 ="SELECT s.kel_jns,substr( d.kd_barang, 1, 2 ) kdBrg, + substr( d.kd_barang, 5, 1 ) dlmpdk,k.ked_produk, + sum( d.jumlah ) jum,sum(d.jumlah*d.harga_satuan) hp + FROM d_retur_beli d, m_retur_beli m, kedalaman_produk k,strip s + WHERE d.id_retur = m.id_retur + AND s.kd_strip = substr( d.kd_barang, 1, 2 ) + AND k.kode_strip = substr( d.kd_barang, 1, 2 ) + AND k.kode_ked_produk = substr( d.kd_barang, 5, 1 ) + AND m.tgl_retur BETWEEN '$startDate' AND '$endDate' AND m.validasi = '1' + GROUP BY substr( d.kd_barang, 1, 2 ) , substr( d.kd_barang, 5, 1 )"; + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cekR = mysqli_stmt_num_rows($stmt2); + if($cekR >= 0){//jika ada retur + mysqli_stmt_bind_result($stmt2,$kel,$str,$kdsup,$nmsup,$jmlRetur,$rpRetur); + + $priaR = 0; + $wanitaR = 0; + $anakR = 0; + $sepatuR = 0; + $strRet = array(); + $jmlR = array(); + $rpR = array(); + + $ttJmlRetur = array(); + $ttJmlRetur['pria']['jml'] = 0; + $ttJmlRetur['pria']['rp'] = 0; + $ttJmlRetur['wanita']['jml'] = 0; + $ttJmlRetur['wanita']['rp'] = 0; + $ttJmlRetur['anak']['jml'] = 0; + $ttJmlRetur['anak']['rp'] = 0; + $ttJmlRetur['sepatu']['jml'] = 0; + $ttJmlRetur['sepatu']['rp'] = 0; + + + while(mysqli_stmt_fetch($stmt2)){ + if($kel == 'P'){ + $strRet[$priaR]['pria'] = $str; + $jmlR[$priaR]['pria'] = $jmlRetur; + $rpR[$priaR]['pria'] = $rpRetur; + $ttJmlRetur['pria']['jml'] += $jmlRetur; + $ttJmlRetur['pria']['rp'] += $rpRetur; + $kdSupplier[$priaR]['pria'] = $kdsup; + $nmSupplier[$priaR]['pria'] = $nmsup; + $priaR++; + }elseif($kel == 'W'){ + $strRet[$wanitaR]['wanita'] = $str; + $jmlR[$wanitaR]['wanita'] = $jmlRetur; + $rpR[$wanitaR]['wanita'] = $rpRetur; + $ttJmlRetur['wanita']['jml'] += $jmlRetur; + $ttJmlRetur['wanita']['rp'] += $rpRetur; + $kdSupplier[$wanitaR]['wanita'] = $kdsup; + $nmSupplier[$wanitaR]['wanita'] = $nmsup; + $wanitaR++; + }elseif($kel == 'A'){ + $strRet[$anakR]['anak'] = $str; + $jmlR[$anakR]['anak'] = $jmlRetur; + $rpR[$anakR]['anak'] = $rpRetur; + $ttJmlRetur['anak']['jml'] += $jmlRetur; + $ttJmlRetur['anak']['rp'] += $rpRetur; + $kdSupplier[$anakR]['anak'] = $kdsup; + $nmSupplier[$anakR]['anak'] = $nmsup; + $anakR++; + }else{ + $strRet[$sepatuR]['sepatu'] = $str; + $jmlR[$sepatuR]['sepatu'] = $jmlRetur; + $rpR[$sepatuR]['sepatu'] = $rpRetur; + $ttJmlRetur['sepatu']['jml'] += $jmlRetur; + $ttJmlRetur['sepatu']['rp'] += $rpRetur; + $kdSupplier[$sepatuR]['sepatu'] = $kdsup; + $nmSupplier[$sepatuR]['sepatu'] = $nmsup; + $sepatuR++; + } + } + + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_free_result($stmt2); + mysqli_stmt_close($stmt2); + } + } + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek >= 0){ + mysqli_stmt_bind_result($stmt,$kelJns,$strip,$kd,$nm,$jmlBeli,$hrgPokok); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + + print("
"); + print("

Laporan Pembelian Per Kedalaman Produk



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PADA TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $str = array(); + $jmlB = array(); + $rpB = array(); + $HP = array(); + + while(mysqli_stmt_fetch($stmt)){ + if($jmlRetur == ''){ + $jmlRetur = 0; + } + if($rpRetur == ''){ + $rpRetur = 0; + } + if($kelJns == "P"){ + $kelJns = "Pria"; + $ttJmlBeli['pria']['jml'] += $jmlBeli; + $ttJmlBeli['pria']['hp'] += $hrgPokok; + $str[$pria]['pria'] = $strip; + $jmlB[$pria]['pria'] = $jmlBeli; + $rpB[$pria]['pria'] = $rpBeli; + $HP[$pria]['pria'] = $hrgPokok; + $kdSupp[$pria]['pria'] = $kd; + $nmSupp[$pria]['pria'] = $nm; + $pria++; + }elseif($kelJns == "W"){ + $kelJns = "Wanita"; + $ttJmlBeli['wanita']['jml'] += $jmlBeli; + $ttJmlBeli['wanita']['hp'] += $hrgPokok; + $str[$wanita]['wanita'] = $strip; + $jmlB[$wanita]['wanita'] = $jmlBeli; + $rpB[$wanita]['wanita'] = $rpBeli; + $HP[$wanita]['wanita'] = $hrgPokok; + $kdSupp[$wanita]['wanita'] = $kd; + $nmSupp[$wanita]['wanita'] = $nm; + $wanita++; + }elseif($kelJns == "A"){ + $kelJns = "Anak"; + $ttJmlBeli['anak']['jml'] += $jmlBeli; + $ttJmlBeli['anak']['hp'] += $hrgPokok; + $str[$anak]['anak'] = $strip; + $jmlB[$anak]['anak'] = $jmlBeli; + $rpB[$anak]['anak'] = $rpBeli; + $HP[$anak]['anak'] = $hrgPokok; + $kdSupp[$anak]['anak'] = $kd; + $nmSupp[$anak]['anak'] = $nm; + $anak++; + }else{ + $kelJns = "Sepatu"; + $ttJmlBeli['sepatu']['jml'] += $jmlBeli; + $ttJmlBeli['sepatu']['hp'] += $hrgPokok; + $str[$sepatu]['sepatu'] = $strip; + $jmlB[$sepatu]['sepatu'] = $jmlBeli; + $rpB[$sepatu]['sepatu'] = $rpBeli; + $HP[$sepatu]['sepatu'] = $hrgPokok; + $kdSupp[$sepatu]['sepatu'] = $kd; + $nmSupp[$sepatu]['sepatu'] = $nm; + $sepatu++; + } + + } + print(""); + print(""); + print("
"); + +/* PRIA -------------------------------------------------------------------------*/ + $jmlkatpria = $ttJmlBeli['pria']['jml']-$ttJmlRetur['pria']['jml']; + $hpkatpria = $ttJmlBeli['pria']['hp']-$ttJmlRetur['pria']['rp']; + + if($ttJmlBeli['pria']['jml']!=0){ + print("
"); + for($i=0;$i<$pria;$i++){ + print(""); + } + print(""); + } + + if($ttJmlRetur['pria']['jml']!= 0){ + print(""); + for($x=0;$x<$priaR;$x++){ + print(""); + } + print(""); + } + + print(""); +/* WANITA -------------------------------------------------------------------------*/ + $jmlkatwanita = $ttJmlBeli['wanita']['jml']-$ttJmlRetur['wanita']['jml']; + $hpkatwanita = $ttJmlBeli['wanita']['hp']-$ttJmlRetur['wanita']['rp']; + + if($ttJmlBeli['wanita']['jml']!=0){ + print(""); + for($i=0;$i<$wanita;$i++){ + print(""); + } + print(""); + } + + if($ttJmlRetur['wanita']['jml']!= 0){ + print(""); + for($x=0;$x<$wanitaR;$x++){ + print(""); + } + print(""); + } + + print(""); +/* ANAK -------------------------------------------------------------------------*/ + $jmlkatanak = $ttJmlBeli['anak']['jml']-$ttJmlRetur['anak']['jml']; + $hpkatanak = $ttJmlBeli['anak']['hp']-$ttJmlRetur['anak']['rp']; + + if($ttJmlBeli['anak']['jml']!=0){ + print(""); + for($i=0;$i<$anak;$i++){ + print(""); + } + print(""); + } + + if($ttJmlRetur['anak']['jml']!= 0){ + print(""); + for($x=0;$x<$anakR;$x++){ + print(""); + } + print(""); + } + + print(""); +/* SEPATU -------------------------------------------------------------------------*/ + $jmlkatsepatu = $ttJmlBeli['sepatu']['jml']-$ttJmlRetur['sepatu']['jml']; + $hpkatsepatu = $ttJmlBeli['sepatu']['hp']-$ttJmlRetur['sepatu']['rp']; + + if($ttJmlBeli['sepatu']['jml']!=0){ + print(""); + for($i=0;$i<$sepatu;$i++){ + print(""); + } + print(""); + } + + if($ttJmlRetur['sepatu']['jml']!= 0){ + print(""); + for($x=0;$x<$sepatuR;$x++){ + print(""); + } + print(""); + } + + print(""); + + $ttjml = $jmlkatpria + $jmlkatwanita + $jmlkatanak + $jmlkatsepatu; + $ttrp = $rpkatpria + $rpkatwanita + $rpkatanak + $rpkatsepatu; + $tthp = $hpkatpria + $hpkatwanita + $hpkatanak + $hpkatsepatu; + + print(" + + "); + + print("
KategoriLini ProdukKedalaman Prod.NamaJumlah BeliTotal HP
Pria
~".$str[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlB[$i]['pria'], 0, ",", ".")."".number_format($HP[$i]['pria'], 0, ",", ".")."
".number_format($ttJmlBeli['pria']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['hp'], 0, ",", ".")."
Retur Pria
~".$strRet[$x]['pria'].".".$kdSupplier[$x]['pria']."".$nmSupplier[$x]['pria']."".number_format($jmlR[$x]['pria'], 0, ",", ".")."".number_format($rpR[$x]['pria'], 0, ",", ".")."
".number_format($ttJmlRetur['pria']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['pria']['rp'], 0, ",", ".")."
TOTAL PRIA".number_format($jmlkatpria, 0, ",", ".")."".number_format($hpkatpria, 0, ",", ".")."
Wanita
~".$str[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlB[$i]['wanita'], 0, ",", ".")."".number_format($HP[$i]['wanita'], 0, ",", ".")."
".number_format($ttJmlBeli['wanita']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['hp'], 0, ",", ".")."
Retur Wanita
~".$strRet[$x]['wanita'].".".$kdSupplier[$x]['wanita']."".$nmSupplier[$x]['wanita']."".number_format($jmlR[$x]['wanita'], 0, ",", ".")."".number_format($rpR[$x]['wanita'], 0, ",", ".")."
".number_format($ttJmlRetur['wanita']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['wanita']['rp'], 0, ",", ".")."
TOTAL Wanita".number_format($jmlkatwanita, 0, ",", ".")."".number_format($hpkatwanita, 0, ",", ".")."
Anak
~".$str[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlB[$i]['anak'], 0, ",", ".")."".number_format($HP[$i]['anak'], 0, ",", ".")."
".number_format($ttJmlBeli['anak']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['hp'], 0, ",", ".")."
Retur Anak
~".$strRet[$x]['anak'].".".$kdSupplier[$x]['anak']."".$nmSupplier[$x]['anak']."".number_format($jmlR[$x]['anak'], 0, ",", ".")."".number_format($rpR[$x]['anak'], 0, ",", ".")."
".number_format($ttJmlRetur['anak']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['anak']['rp'], 0, ",", ".")."
TOTAL Anak".number_format($jmlkatanak, 0, ",", ".")."".number_format($hpkatanak, 0, ",", ".")."
Sepatu
~".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($ttJmlBeli['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp'], 0, ",", ".")."
Retur Sepatu
~".$strRet[$x]['sepatu'].".".$kdSupplier[$x]['sepatu']."".$nmSupplier[$x]['sepatu']."".number_format($jmlR[$x]['sepatu'], 0, ",", ".")."".number_format($rpR[$x]['sepatu'], 0, ",", ".")."
".number_format($ttJmlRetur['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['sepatu']['rp'], 0, ",", ".")."
TOTAL Sepatu".number_format($jmlkatsepatu, 0, ",", ".")."".number_format($hpkatsepatu, 0, ",", ".")."
T O T A L : ".number_format($ttjml, 0, ",", ".")."".number_format($tthp, 0, ",", ".")."

"); + }else{ + echo "Belum ada data pembelian untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/lapbelikons.php b/old-source/LaporanBeli/lapbelikons.php new file mode 100644 index 0000000..5f5b4fa --- /dev/null +++ b/old-source/LaporanBeli/lapbelikons.php @@ -0,0 +1,273 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:700px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + + if(bukaKoneksi()){ + global $conn; + + $query = "SELECT s.kel_jns,s.nama_strip lini, m.kd_supplier, u.nama_supplier, + sum( d.jum_fisik ) jum, + sum(d.jum_fisik*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + FROM d_pembelian d, m_pembelian m, supplier u,strip s,barang b + WHERE d.no_faktur = m.no_faktur + AND left(m.no_faktur,4) <> 'RVB-' + AND b.kode_barang = d.kode_barang + AND s.kd_strip = b.kode_strip + AND u.kd_supplier = m.kd_supplier + AND m.status = 'K' + AND m.tgl_masuk BETWEEN '$startDate' AND '$endDate' + AND m.validasi = '1' + GROUP BY b.kode_strip , m.kd_supplier"; + $query2 ="SELECT s.kel_jns,s.nama_strip lini, m.kd_supplier, u.nama_supplier, + sum( d.jumlah ) jum,sum(d.jumlah*d.harga_satuan) hp + FROM d_retur_beli d, m_retur_beli m, supplier u,strip s,m_pembelian b,barang br + WHERE d.id_retur = m.id_retur + AND br.kode_barang = d.kd_barang + AND s.kd_strip = br.kode_strip + AND u.kd_supplier = m.kd_supplier + AND m.no_nota = b.no_faktur + AND b.status = 'K' + AND m.tgl_retur BETWEEN '$startDate' AND '$endDate' + AND m.validasi = '1' + GROUP BY br.kode_strip , m.kd_supplier"; + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cekR = mysqli_stmt_num_rows($stmt2); + if($cekR >= 0){//jika ada retur + mysqli_stmt_bind_result($stmt2,$kel,$str,$kdsup,$nmsup,$jmlRetur,$rpRetur); + + $priaR = 0; + $wanitaR = 0; + $anakR = 0; + $sepatuR = 0; + $strRet = array(); + $jmlR = array(); + $rpR = array(); + + $ttJmlRetur = array(); + $ttJmlRetur['pria']['jml'] = 0; + $ttJmlRetur['pria']['rp'] = 0; + $ttJmlRetur['wanita']['jml'] = 0; + $ttJmlRetur['wanita']['rp'] = 0; + $ttJmlRetur['anak']['jml'] = 0; + $ttJmlRetur['anak']['rp'] = 0; + $ttJmlRetur['sepatu']['jml'] = 0; + $ttJmlRetur['sepatu']['rp'] = 0; + + + while(mysqli_stmt_fetch($stmt2)){ + if($kel == 'P'){ + $strRet[$priaR]['pria'] = $str; + $jmlR[$priaR]['pria'] = $jmlRetur; + $rpR[$priaR]['pria'] = $rpRetur; + $ttJmlRetur['pria']['jml'] += $jmlRetur; + $ttJmlRetur['pria']['rp'] += $rpRetur; + $kdSupplier[$priaR]['pria'] = $kdsup; + $nmSupplier[$priaR]['pria'] = $nmsup; + $priaR++; + }elseif($kel == 'W'){ + $strRet[$wanitaR]['wanita'] = $str; + $jmlR[$wanitaR]['wanita'] = $jmlRetur; + $rpR[$wanitaR]['wanita'] = $rpRetur; + $ttJmlRetur['wanita']['jml'] += $jmlRetur; + $ttJmlRetur['wanita']['rp'] += $rpRetur; + $kdSupplier[$wanitaR]['wanita'] = $kdsup; + $nmSupplier[$wanitaR]['wanita'] = $nmsup; + $wanitaR++; + }elseif($kel == 'A'){ + $strRet[$anakR]['anak'] = $str; + $jmlR[$anakR]['anak'] = $jmlRetur; + $rpR[$anakR]['anak'] = $rpRetur; + $ttJmlRetur['anak']['jml'] += $jmlRetur; + $ttJmlRetur['anak']['rp'] += $rpRetur; + $kdSupplier[$anakR]['anak'] = $kdsup; + $nmSupplier[$anakR]['anak'] = $nmsup; + $anakR++; + }else{ + $strRet[$sepatuR]['sepatu'] = $str; + $jmlR[$sepatuR]['sepatu'] = $jmlRetur; + $rpR[$sepatuR]['sepatu'] = $rpRetur; + $ttJmlRetur['sepatu']['jml'] += $jmlRetur; + $ttJmlRetur['sepatu']['rp'] += $rpRetur; + $kdSupplier[$sepatuR]['sepatu'] = $kdsup; + $nmSupplier[$sepatuR]['sepatu'] = $nmsup; + $sepatuR++; + } + } + + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_free_result($stmt2); + mysqli_stmt_close($stmt2); + } + } + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek >= 0){ + mysqli_stmt_bind_result($stmt,$kelJns,$strip,$kd,$nm,$jmlBeli,$hrgPokok); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + + print("
"); + print("

Laporan Pembelian Konsinyasi Per Supllier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PADA TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $str = array(); + $jmlB = array(); + $rpB = array(); + $HP = array(); + + while(mysqli_stmt_fetch($stmt)){ + if($jmlRetur == ''){ + $jmlRetur = 0; + } + if($rpRetur == ''){ + $rpRetur = 0; + } + if($kelJns == "P"){ + $kelJns = "Pria"; + $ttJmlBeli['pria']['jml'] += $jmlBeli; + $ttJmlBeli['pria']['hp'] += $hrgPokok; + $str[$pria]['pria'] = $strip; + $jmlB[$pria]['pria'] = $jmlBeli; + $rpB[$pria]['pria'] = $rpBeli; + $HP[$pria]['pria'] = $hrgPokok; + $kdSupp[$pria]['pria'] = $kd; + $nmSupp[$pria]['pria'] = $nm; + $pria++; + }elseif($kelJns == "W"){ + $kelJns = "Wanita"; + $ttJmlBeli['wanita']['jml'] += $jmlBeli; + $ttJmlBeli['wanita']['hp'] += $hrgPokok; + $str[$wanita]['wanita'] = $strip; + $jmlB[$wanita]['wanita'] = $jmlBeli; + $rpB[$wanita]['wanita'] = $rpBeli; + $HP[$wanita]['wanita'] = $hrgPokok; + $kdSupp[$wanita]['wanita'] = $kd; + $nmSupp[$wanita]['wanita'] = $nm; + $wanita++; + }elseif($kelJns == "A"){ + $kelJns = "Anak"; + $ttJmlBeli['anak']['jml'] += $jmlBeli; + $ttJmlBeli['anak']['hp'] += $hrgPokok; + $str[$anak]['anak'] = $strip; + $jmlB[$anak]['anak'] = $jmlBeli; + $rpB[$anak]['anak'] = $rpBeli; + $HP[$anak]['anak'] = $hrgPokok; + $kdSupp[$anak]['anak'] = $kd; + $nmSupp[$anak]['anak'] = $nm; + $anak++; + }else{ + $kelJns = "Sepatu"; + $ttJmlBeli['sepatu']['jml'] += $jmlBeli; + $ttJmlBeli['sepatu']['hp'] += $hrgPokok; + $str[$sepatu]['sepatu'] = $strip; + $jmlB[$sepatu]['sepatu'] = $jmlBeli; + $rpB[$sepatu]['sepatu'] = $rpBeli; + $HP[$sepatu]['sepatu'] = $hrgPokok; + $kdSupp[$sepatu]['sepatu'] = $kd; + $nmSupp[$sepatu]['sepatu'] = $nm; + $sepatu++; + } + + } + print(""); + print(""); + print("
"); + +// SEPATU ------------------------------------------------------------------------- + $jmlkatsepatu = $ttJmlBeli['sepatu']['jml']-$ttJmlRetur['sepatu']['jml']; + $hpkatsepatu = $ttJmlBeli['sepatu']['hp']-$ttJmlRetur['sepatu']['rp']; + + if($ttJmlBeli['sepatu']['jml']!=0){ + print("
"); + for($i=0;$i<$sepatu;$i++){ + if ($str[$i-1]['sepatu']==$str[$i]['sepatu']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlah4 = 0; + $temphp4 = 0; + } + $tempjumlah4 += $jmlB[$i]['sepatu']; + $temphp4 += $HP[$i]['sepatu']; + } + print(""); + print(""); + } + + if($ttJmlRetur['sepatu']['jml']!= 0){ + print(""); + for($x=0;$x<$sepatuR;$x++){ + if ($strRet[$x-1]['sepatu']==$strRet[$x]['sepatu']){ + print(""); + }else{ + print(""); + print(""); + + $tmpjmlR4 = 0; + $tmprpR4 = 0; + } + $tmpjmlR4 += $jmlR[$x]['sepatu']; + $tmprpR4 += $rpR[$x]['sepatu']; + } + print(""); + print(""); + } + print(""); +//---------------------------------------------------------------------------- + $ttjml = $jmlkatpria + $jmlkatwanita + $jmlkatanak + $jmlkatsepatu; + $ttrp = $rpkatpria + $rpkatwanita + $rpkatanak + $rpkatsepatu; + $tthp = $hpkatpria + $hpkatwanita + $hpkatanak + $hpkatsepatu; + + print(" + + "); + + print("
Lini ProdukKode SupplierNama SupplierJumlah BeliTotal HP
".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlah4, 0, ",", ".")."".number_format($temphp4, 0, ",", ".")."
".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlah4, 0, ",", ".")."".number_format($temphp4, 0, ",", ".")."
SUB TOTAL".number_format($ttJmlBeli['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp'], 0, ",", ".")."
Data Retur
".$strRet[$x]['sepatu'].".".$kdSupplier[$x]['sepatu']."".$nmSupplier[$x]['sepatu']."".number_format($jmlR[$x]['sepatu'], 0, ",", ".")."".number_format($rpR[$x]['sepatu'], 0, ",", ".")."
".number_format($tmpjmlR4, 0, ",", ".")."".number_format($tmprpR4, 0, ",", ".")."
".$strRet[$x]['sepatu'].".".$kdSupplier[$x]['sepatu']."".$nmSupplier[$x]['sepatu']."".number_format($jmlR[$x]['sepatu'], 0, ",", ".")."".number_format($rpR[$x]['sepatu'], 0, ",", ".")."
".number_format($tmpjmlR4, 0, ",", ".")."".number_format($tmprpR4, 0, ",", ".")."
SUB TOTAL".number_format($ttJmlRetur['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['sepatu']['rp'], 0, ",", ".")."
Sub Total".number_format($jmlkatsepatu, 0, ",", ".")."".number_format($hpkatsepatu, 0, ",", ".")."
T O T A L : ".number_format($ttjml, 0, ",", ".")."".number_format($tthp, 0, ",", ".")."

"); + }else{ + echo "Belum ada data pembelian untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/lapbelikons.php~ b/old-source/LaporanBeli/lapbelikons.php~ new file mode 100644 index 0000000..7012f90 --- /dev/null +++ b/old-source/LaporanBeli/lapbelikons.php~ @@ -0,0 +1,309 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:700px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + + if(bukaKoneksi()){ + global $conn; + + $query = "SELECT s.kel_jns,substr( d.kode_barang, 1, 2 ) kdBrg, m.kd_supplier, u.nama_supplier, + sum( d.jumlah ) jum, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + FROM d_pembelian d, m_pembelian m, supplier u,strip s + WHERE d.no_faktur = m.no_faktur + AND s.kd_strip = substr( d.kode_barang, 1, 2 ) + AND u.kd_supplier = m.kd_supplier + AND m.status = 'K' + AND m.tgl_masuk BETWEEN '$startDate' AND '$endDate' AND m.validasi = '1' + GROUP BY substr( d.kode_barang, 1, 2 ) , m.kd_supplier"; + $query2 ="SELECT s.kel_jns,substr( d.kd_barang, 1, 2 ) kdBrg, m.kd_supplier, u.nama_supplier, + sum( d.jumlah ) jum,sum(d.jumlah*d.harga_satuan) hp + FROM d_retur_beli d, m_retur_beli m, supplier u,strip s,m_pembelian b + WHERE d.id_retur = m.id_retur + AND s.kd_strip = substr( d.kd_barang, 1, 2 ) + AND u.kd_supplier = m.kd_supplier + AND m.no_nota = b.no_faktur + AND b.status = 'K' + AND m.tgl_retur BETWEEN '$startDate' AND '$endDate' AND m.validasi = '1' + GROUP BY substr( d.kd_barang, 1, 2 ) , m.kd_supplier"; + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cekR = mysqli_stmt_num_rows($stmt2); + if($cekR >= 0){//jika ada retur + mysqli_stmt_bind_result($stmt2,$kel,$str,$kdsup,$nmsup,$jmlRetur,$rpRetur); + + $priaR = 0; + $wanitaR = 0; + $anakR = 0; + $sepatuR = 0; + $strRet = array(); + $jmlR = array(); + $rpR = array(); + + $ttJmlRetur = array(); + $ttJmlRetur['pria']['jml'] = 0; + $ttJmlRetur['pria']['rp'] = 0; + $ttJmlRetur['wanita']['jml'] = 0; + $ttJmlRetur['wanita']['rp'] = 0; + $ttJmlRetur['anak']['jml'] = 0; + $ttJmlRetur['anak']['rp'] = 0; + $ttJmlRetur['sepatu']['jml'] = 0; + $ttJmlRetur['sepatu']['rp'] = 0; + + + while(mysqli_stmt_fetch($stmt2)){ + if($kel == 'P'){ + $strRet[$priaR]['pria'] = $str; + $jmlR[$priaR]['pria'] = $jmlRetur; + $rpR[$priaR]['pria'] = $rpRetur; + $ttJmlRetur['pria']['jml'] += $jmlRetur; + $ttJmlRetur['pria']['rp'] += $rpRetur; + $kdSupplier[$priaR]['pria'] = $kdsup; + $nmSupplier[$priaR]['pria'] = $nmsup; + $priaR++; + }elseif($kel == 'W'){ + $strRet[$wanitaR]['wanita'] = $str; + $jmlR[$wanitaR]['wanita'] = $jmlRetur; + $rpR[$wanitaR]['wanita'] = $rpRetur; + $ttJmlRetur['wanita']['jml'] += $jmlRetur; + $ttJmlRetur['wanita']['rp'] += $rpRetur; + $kdSupplier[$wanitaR]['wanita'] = $kdsup; + $nmSupplier[$wanitaR]['wanita'] = $nmsup; + $wanitaR++; + }elseif($kel == 'A'){ + $strRet[$anakR]['anak'] = $str; + $jmlR[$anakR]['anak'] = $jmlRetur; + $rpR[$anakR]['anak'] = $rpRetur; + $ttJmlRetur['anak']['jml'] += $jmlRetur; + $ttJmlRetur['anak']['rp'] += $rpRetur; + $kdSupplier[$anakR]['anak'] = $kdsup; + $nmSupplier[$anakR]['anak'] = $nmsup; + $anakR++; + }else{ + $strRet[$sepatuR]['sepatu'] = $str; + $jmlR[$sepatuR]['sepatu'] = $jmlRetur; + $rpR[$sepatuR]['sepatu'] = $rpRetur; + $ttJmlRetur['sepatu']['jml'] += $jmlRetur; + $ttJmlRetur['sepatu']['rp'] += $rpRetur; + $kdSupplier[$sepatuR]['sepatu'] = $kdsup; + $nmSupplier[$sepatuR]['sepatu'] = $nmsup; + $sepatuR++; + } + } + + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_free_result($stmt2); + mysqli_stmt_close($stmt2); + } + } + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek >= 0){ + mysqli_stmt_bind_result($stmt,$kelJns,$strip,$kd,$nm,$jmlBeli,$hrgPokok); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + + print("
"); + print("

Laporan Pembelian Per Supllier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PADA TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $str = array(); + $jmlB = array(); + $rpB = array(); + $HP = array(); + + while(mysqli_stmt_fetch($stmt)){ + if($jmlRetur == ''){ + $jmlRetur = 0; + } + if($rpRetur == ''){ + $rpRetur = 0; + } + if($kelJns == "P"){ + $kelJns = "Pria"; + $ttJmlBeli['pria']['jml'] += $jmlBeli; + $ttJmlBeli['pria']['hp'] += $hrgPokok; + $str[$pria]['pria'] = $strip; + $jmlB[$pria]['pria'] = $jmlBeli; + $rpB[$pria]['pria'] = $rpBeli; + $HP[$pria]['pria'] = $hrgPokok; + $kdSupp[$pria]['pria'] = $kd; + $nmSupp[$pria]['pria'] = $nm; + $pria++; + }elseif($kelJns == "W"){ + $kelJns = "Wanita"; + $ttJmlBeli['wanita']['jml'] += $jmlBeli; + $ttJmlBeli['wanita']['hp'] += $hrgPokok; + $str[$wanita]['wanita'] = $strip; + $jmlB[$wanita]['wanita'] = $jmlBeli; + $rpB[$wanita]['wanita'] = $rpBeli; + $HP[$wanita]['wanita'] = $hrgPokok; + $kdSupp[$wanita]['wanita'] = $kd; + $nmSupp[$wanita]['wanita'] = $nm; + $wanita++; + }elseif($kelJns == "A"){ + $kelJns = "Anak"; + $ttJmlBeli['anak']['jml'] += $jmlBeli; + $ttJmlBeli['anak']['hp'] += $hrgPokok; + $str[$anak]['anak'] = $strip; + $jmlB[$anak]['anak'] = $jmlBeli; + $rpB[$anak]['anak'] = $rpBeli; + $HP[$anak]['anak'] = $hrgPokok; + $kdSupp[$anak]['anak'] = $kd; + $nmSupp[$anak]['anak'] = $nm; + $anak++; + }else{ + $kelJns = "Sepatu"; + $ttJmlBeli['sepatu']['jml'] += $jmlBeli; + $ttJmlBeli['sepatu']['hp'] += $hrgPokok; + $str[$sepatu]['sepatu'] = $strip; + $jmlB[$sepatu]['sepatu'] = $jmlBeli; + $rpB[$sepatu]['sepatu'] = $rpBeli; + $HP[$sepatu]['sepatu'] = $hrgPokok; + $kdSupp[$sepatu]['sepatu'] = $kd; + $nmSupp[$sepatu]['sepatu'] = $nm; + $sepatu++; + } + + } + print(""); + print(""); + print("
"); + +/* PRIA -------------------------------------------------------------------------*/ + $jmlkatpria = $ttJmlBeli['pria']['jml']-$ttJmlRetur['pria']['jml']; + $hpkatpria = $ttJmlBeli['pria']['hp']-$ttJmlRetur['pria']['rp']; + + if($ttJmlBeli['pria']['jml']!=0){ + print("
"); + for($i=0;$i<$pria;$i++){ + print(""); + } + print(""); + } + + if($ttJmlRetur['pria']['jml']!= 0){ + print(""); + for($x=0;$x<$priaR;$x++){ + print(""); + } + print(""); + } + + print(""); +/* WANITA -------------------------------------------------------------------------*/ + $jmlkatwanita = $ttJmlBeli['wanita']['jml']-$ttJmlRetur['wanita']['jml']; + $hpkatwanita = $ttJmlBeli['wanita']['hp']-$ttJmlRetur['wanita']['rp']; + + if($ttJmlBeli['wanita']['jml']!=0){ + print(""); + for($i=0;$i<$wanita;$i++){ + print(""); + } + print(""); + } + + if($ttJmlRetur['wanita']['jml']!= 0){ + print(""); + for($x=0;$x<$wanitaR;$x++){ + print(""); + } + print(""); + } + + print(""); +/* ANAK -------------------------------------------------------------------------*/ + $jmlkatanak = $ttJmlBeli['anak']['jml']-$ttJmlRetur['anak']['jml']; + $hpkatanak = $ttJmlBeli['anak']['hp']-$ttJmlRetur['anak']['rp']; + + if($ttJmlBeli['anak']['jml']!=0){ + print(""); + for($i=0;$i<$anak;$i++){ + print(""); + } + print(""); + } + + if($ttJmlRetur['anak']['jml']!= 0){ + print(""); + for($x=0;$x<$anakR;$x++){ + print(""); + } + print(""); + } + + print(""); +/* SEPATU -------------------------------------------------------------------------*/ + $jmlkatsepatu = $ttJmlBeli['sepatu']['jml']-$ttJmlRetur['sepatu']['jml']; + $hpkatsepatu = $ttJmlBeli['sepatu']['hp']-$ttJmlRetur['sepatu']['rp']; + + if($ttJmlBeli['sepatu']['jml']!=0){ + print(""); + for($i=0;$i<$sepatu;$i++){ + print(""); + } + print(""); + } + + if($ttJmlRetur['sepatu']['jml']!= 0){ + print(""); + for($x=0;$x<$sepatuR;$x++){ + print(""); + } + print(""); + } + + print(""); + + $ttjml = $jmlkatpria + $jmlkatwanita + $jmlkatanak + $jmlkatsepatu; + $ttrp = $rpkatpria + $rpkatwanita + $rpkatanak + $rpkatsepatu; + $tthp = $hpkatpria + $hpkatwanita + $hpkatanak + $hpkatsepatu; + + print(" + + "); + + print("
KategoriLini ProdukKode SupplierNama SupplierJumlah BeliTotal HP
Pria
~".$str[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlB[$i]['pria'], 0, ",", ".")."".number_format($HP[$i]['pria'], 0, ",", ".")."
".number_format($ttJmlBeli['pria']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['hp'], 0, ",", ".")."
Retur Pria
~".$strRet[$x]['pria'].".".$kdSupplier[$x]['pria']."".$nmSupplier[$x]['pria']."".number_format($jmlR[$x]['pria'], 0, ",", ".")."".number_format($rpR[$x]['pria'], 0, ",", ".")."
".number_format($ttJmlRetur['pria']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['pria']['rp'], 0, ",", ".")."
TOTAL PRIA".number_format($jmlkatpria, 0, ",", ".")."".number_format($hpkatpria, 0, ",", ".")."
Wanita
~".$str[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlB[$i]['wanita'], 0, ",", ".")."".number_format($HP[$i]['wanita'], 0, ",", ".")."
".number_format($ttJmlBeli['wanita']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['hp'], 0, ",", ".")."
Retur Wanita
~".$strRet[$x]['wanita'].".".$kdSupplier[$x]['wanita']."".$nmSupplier[$x]['wanita']."".number_format($jmlR[$x]['wanita'], 0, ",", ".")."".number_format($rpR[$x]['wanita'], 0, ",", ".")."
".number_format($ttJmlRetur['wanita']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['wanita']['rp'], 0, ",", ".")."
TOTAL Wanita".number_format($jmlkatwanita, 0, ",", ".")."".number_format($hpkatwanita, 0, ",", ".")."
Anak
~".$str[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlB[$i]['anak'], 0, ",", ".")."".number_format($HP[$i]['anak'], 0, ",", ".")."
".number_format($ttJmlBeli['anak']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['hp'], 0, ",", ".")."
Retur Anak
~".$strRet[$x]['anak'].".".$kdSupplier[$x]['anak']."".$nmSupplier[$x]['anak']."".number_format($jmlR[$x]['anak'], 0, ",", ".")."".number_format($rpR[$x]['anak'], 0, ",", ".")."
".number_format($ttJmlRetur['anak']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['anak']['rp'], 0, ",", ".")."
TOTAL Anak".number_format($jmlkatanak, 0, ",", ".")."".number_format($hpkatanak, 0, ",", ".")."
Sepatu
~".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($ttJmlBeli['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp'], 0, ",", ".")."
Retur Sepatu
~".$strRet[$x]['sepatu'].".".$kdSupplier[$x]['sepatu']."".$nmSupplier[$x]['sepatu']."".number_format($jmlR[$x]['sepatu'], 0, ",", ".")."".number_format($rpR[$x]['sepatu'], 0, ",", ".")."
".number_format($ttJmlRetur['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['sepatu']['rp'], 0, ",", ".")."
TOTAL Sepatu".number_format($jmlkatsepatu, 0, ",", ".")."".number_format($hpkatsepatu, 0, ",", ".")."
T O T A L : ".number_format($ttjml, 0, ",", ".")."".number_format($tthp, 0, ",", ".")."

"); + }else{ + echo "Belum ada data pembelian untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/lapbeliperfak.php b/old-source/LaporanBeli/lapbeliperfak.php new file mode 100644 index 0000000..9d5e582 --- /dev/null +++ b/old-source/LaporanBeli/lapbeliperfak.php @@ -0,0 +1,109 @@ +"; + echo "div#divprint{width:1024px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:950px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:50px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $kdsupp = $_POST['kdsupp']; + + + if(bukaKoneksi()){ + global $conn; + + if($kdsupp != ""){ + $query = "SELECT m.no_faktur, m.tgl_masuk, m.tgl_nota, m.tgl_jatuh_tempo, m.kd_supplier, s.nama_supplier, sum( d.jum_fisik ) total_beli, + m.rp_beli, + m.keterangan, k.nama + FROM d_pembelian d, m_pembelian m, supplier s, karyawan k + WHERE d.no_faktur = m.no_faktur + AND s.kd_supplier = m.kd_supplier + AND m.tgl_masuk + BETWEEN '$startDate' AND '$endDate' + AND m.validasi = '1' + AND m.status_revisi = '1' + AND m.nik = k.nik + AND s.kd_supplier = '$kdsupp' + GROUP BY m.no_faktur + ORDER BY m.tgl_masuk, m.kd_supplier"; + + }else{ //sum(d.jum_fisik*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) rp_beli, + $query = "SELECT m.no_faktur, m.tgl_masuk, m.tgl_nota, m.tgl_jatuh_tempo, m.kd_supplier, s.nama_supplier, sum( d.jum_fisik ) total_beli, + m.rp_beli, + m.keterangan, k.nama + FROM d_pembelian d, m_pembelian m, supplier s, karyawan k + WHERE d.no_faktur = m.no_faktur + AND s.kd_supplier = m.kd_supplier + AND m.tgl_masuk + BETWEEN '$startDate' AND '$endDate' + AND m.validasi = '1' + AND m.status_revisi = '1' + AND m.nik = k.nik + GROUP BY m.no_faktur + ORDER BY m.tgl_masuk, m.kd_supplier"; + + } + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$faktur,$tglMsk,$tglNota,$tglTmp,$kdSup,$nmSup,$ttBeli,$ttRp,$ket,$name); + $ttJumlah = array(); + $ttJumlah['faktur'] = 0; + $ttJumlah['jml'] = 0; + $ttJumlah['rp'] = 0; + + + print("
"); + print("

Laporan Pembelian Barang Per Nomor Faktur



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("*** PM.5 ***
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['faktur']++; + $ttJumlah['jml'] += $ttBeli; + $ttJumlah['rp'] += $ttRp; + + print(" + + + + + "); + } + + print("
No. FakturTanggal MasukTanggal NotaTanggal Jt TempoKode Supp.Nama SupplierJumlah PembelianTotal PembelianKeteranganNama Assko
.$faktur".encTgl($tglMsk)."".encTgl($tglNota)."".encTgl($tglTmp).".$kdSup$nmSup".number_format($ttBeli,0,',','.')."".number_format($ttRp,0,',','.')."$ket$name

"); + print("
"); + print(""); + print(""); + print(""); + + print("
Total Lembar Nota : ".number_format($ttJumlah['faktur'],0,',','.')."
Total Jumlah Beli : ".number_format($ttJumlah['jml'],0,',','.')."
Total Pembelian : ".number_format($ttJumlah['rp'],0,',','.')."
"); + }else{ + echo "Belum ada data pembelian untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/lapbeliperfak.php~ b/old-source/LaporanBeli/lapbeliperfak.php~ new file mode 100644 index 0000000..a1b6d28 --- /dev/null +++ b/old-source/LaporanBeli/lapbeliperfak.php~ @@ -0,0 +1,70 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + + if(bukaKoneksi()){ + global $conn; + $query = "SELECT m.no_faktur, m.tgl_masuk, m.tgl_nota, m.tgl_jatuh_tempo, + m.kd_supplier, s.nama_supplier, m.total_beli, m.rp_beli + FROM m_pembelian m, supplier s + WHERE s.kd_supplier = m.kd_supplier AND m.tgl_masuk between '$startDate' AND '$endDate' AND m.validasi = '1' + ORDER BY m.tgl_masuk,m.kd_supplier"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$faktur,$tglMsk,$tglNota,$tglTmp,$kdSup,$nmSup,$ttBeli,$ttRp); + $ttJumlah = array(); + $ttJumlah['jml'] = 0; + $ttJumlah['rp'] = 0; + + print("
"); + print("

Laporan Pembelian Barang Per Nomor Faktur



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("*** PM.5 ***
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['jml'] += $ttBeli; + $ttJumlah['rp'] += $ttRp; + print(""); + } + + print("
No. FakturTanggal MasukTanggal NotaTanggal Jt TempoKode Supp.Nama SupplierJumlah PembelianTotal Pembelian
.$faktur".encTgl($tglMsk)."".encTgl($tglNota)."".encTgl($tglTmp).".$kdSup$nmSup".number_format($ttBeli,0,',','.')."".number_format($ttRp,0,',','.')."

"); + print("
"); + + print(""); + print(""); + + print("
Total Jumlah Beli : ".number_format($ttJumlah['jml'],0,',','.')."
Total Pembelian : ".number_format($ttJumlah['rp'],0,',','.')."
"); + }else{ + echo "Belum ada data pembelian untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/lapbeliperkat.php b/old-source/LaporanBeli/lapbeliperkat.php new file mode 100644 index 0000000..1257c94 --- /dev/null +++ b/old-source/LaporanBeli/lapbeliperkat.php @@ -0,0 +1,233 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:700px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + if(bukaKoneksi()){ + global $conn; + + $query = "SELECT s.kel_jns,s.nama_strip lini,k.ked_produk, sum( d.jum_fisik ) jum, + sum(d.jum_fisik*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + FROM d_pembelian d, m_pembelian m,strip s,barang b,kedalaman_produk k + WHERE d.no_faktur = m.no_faktur + AND b.kode_barang = d.kode_barang + AND s.kd_strip = b.kode_strip + and (b.kode_strip = k.kode_strip and b.ked_produk = k.kode_ked_produk) + AND m.tgl_masuk BETWEEN '$startDate' AND '$endDate' + AND m.validasi = '1' + AND m.status_revisi = '1' + GROUP BY s.kel_jns,b.kode_strip,b.ked_produk"; + $query2 = "SELECT s.kel_jns, s.nama_strip lini,k.ked_produk, sum( r.jumlah ) jum, + sum( r.jumlah*r.harga_satuan ) hp + FROM d_retur_beli r,strip s,m_retur_beli m, barang b,kedalaman_produk k + WHERE m.tgl_retur BETWEEN '$startDate' AND '$endDate' + AND m.validasi = '1' + AND b.kode_barang = r.kd_barang + and (b.kode_strip = k.kode_strip and b.ked_produk = k.kode_ked_produk) + AND s.kd_strip = b.kode_strip + AND m.id_retur = r.id_retur + GROUP BY s.kel_jns, b.kode_strip,b.ked_produk"; + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cekR = mysqli_stmt_num_rows($stmt2); + if($cekR >= 0){//jika ada retur + mysqli_stmt_bind_result($stmt2,$kel,$str,$subprod,$jmlRetur,$rpRetur); + echo $kel,$str,$jmlRetur,$rpRetur; + $priaR = 0; + $wanitaR = 0; + $anakR = 0; + $sepatuR = 0; + $strRet = array(); + $sub = array(); + $jmlR = array(); + $rpR = array(); + + $ttJmlRetur = array(); + $ttJmlRetur['pria']['jml'] = 0; + $ttJmlRetur['pria']['rp'] = 0; + $ttJmlRetur['wanita']['jml'] = 0; + $ttJmlRetur['wanita']['rp'] = 0; + $ttJmlRetur['anak']['jml'] = 0; + $ttJmlRetur['anak']['rp'] = 0; + $ttJmlRetur['sepatu']['jml'] = 0; + $ttJmlRetur['sepatu']['rp'] = 0; + + + while(mysqli_stmt_fetch($stmt2)){ + if($kel == 'P'){ + $strRet[$priaR]['pria'] = $str; + $jmlR[$priaR]['pria'] = $jmlRetur; + $rpR[$priaR]['pria'] = $rpRetur; + $ttJmlRetur['pria']['jml'] += $jmlRetur; + $ttJmlRetur['pria']['rp'] += $rpRetur; + $priaR++; + }elseif($kel == 'W'){ + $strRet[$wanitaR]['wanita'] = $str; + $jmlR[$wanitaR]['wanita'] = $jmlRetur; + $rpR[$wanitaR]['wanita'] = $rpRetur; + $ttJmlRetur['wanita']['jml'] += $jmlRetur; + $ttJmlRetur['wanita']['rp'] += $rpRetur; + $wanitaR++; + }elseif($kel == 'A'){ + $strRet[$anakR]['anak'] = $str; + $jmlR[$anakR]['anak'] = $jmlRetur; + $rpR[$anakR]['anak'] = $rpRetur; + $ttJmlRetur['anak']['jml'] += $jmlRetur; + $ttJmlRetur['anak']['rp'] += $rpRetur; + $anakR++; + }else{ + $strRet[$sepatuR]['sepatu'] = $str; + $sub[$sepatuR]['sepatu'] = $subprod; + $jmlR[$sepatuR]['sepatu'] = $jmlRetur; + $rpR[$sepatuR]['sepatu'] = $rpRetur; + $ttJmlRetur['sepatu']['jml'] += $jmlRetur; + $ttJmlRetur['sepatu']['rp'] += $rpRetur; + $sepatuR++; + } + } + mysqli_stmt_free_result($stmt2); + mysqli_stmt_close($stmt2); + } + } + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek >= 0){ + mysqli_stmt_bind_result($stmt,$kelJns,$strip,$subprod,$jmlBeli,$hrgPokok); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + + print("
"); + print("

Laporan Pembelian Per Kelompok Kategori



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PADA TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $str = array(); + $sub = array(); + $jmlB = array(); + $rpB = array(); + $HP = array(); + + while(mysqli_stmt_fetch($stmt)){ + if($jmlRetur == ''){ + $jmlRetur = 0; + } + if($rpRetur == ''){ + $rpRetur = 0; + } + if($kelJns == "P"){ + $kelJns = "Pria"; + $ttJmlBeli['pria']['jml'] += $jmlBeli; + $ttJmlBeli['pria']['hp'] += $hrgPokok; + $str[$pria]['pria'] = $strip; + $jmlB[$pria]['pria'] = $jmlBeli; + $rpB[$pria]['pria'] = $rpBeli; + $HP[$pria]['pria'] = $hrgPokok; + $pria++; + }elseif($kelJns == "W"){ + $kelJns = "Wanita"; + $ttJmlBeli['wanita']['jml'] += $jmlBeli; + $ttJmlBeli['wanita']['hp'] += $hrgPokok; + $str[$wanita]['wanita'] = $strip; + $jmlB[$wanita]['wanita'] = $jmlBeli; + $rpB[$wanita]['wanita'] = $rpBeli; + $HP[$wanita]['wanita'] = $hrgPokok; + $wanita++; + }elseif($kelJns == "A"){ + $kelJns = "Anak"; + $ttJmlBeli['anak']['jml'] += $jmlBeli; + $ttJmlBeli['anak']['hp'] += $hrgPokok; + $str[$anak]['anak'] = $strip; + $jmlB[$anak]['anak'] = $jmlBeli; + $rpB[$anak]['anak'] = $rpBeli; + $HP[$anak]['anak'] = $hrgPokok; + $anak++; + }else{ + $kelJns = "Sepatu"; + $ttJmlBeli['sepatu']['jml'] += $jmlBeli; + $ttJmlBeli['sepatu']['hp'] += $hrgPokok; + $str[$sepatu]['sepatu'] = $strip; + $sub[$sepatu]['sepatu'] = $subprod; + $jmlB[$sepatu]['sepatu'] = $jmlBeli; + $rpB[$sepatu]['sepatu'] = $rpBeli; + $HP[$sepatu]['sepatu'] = $hrgPokok; + $sepatu++; + } + + } + print(""); + print(""); + print("
"); + + +/* SEPATU -------------------------------------------------------------------------*/ + $jmlkatsepatu = $ttJmlBeli['sepatu']['jml']-$ttJmlRetur['sepatu']['jml']; + $hpkatsepatu = $ttJmlBeli['sepatu']['hp']-$ttJmlRetur['sepatu']['rp']; + + if($ttJmlBeli['sepatu']['jml']!=0){ + print("
"); + for($i=0;$i<$sepatu;$i++){ + print(""); + } + print(""); + } + + if($ttJmlRetur['sepatu']['jml']!= 0){ + print(""); + for($x=0;$x<$sepatuR;$x++){ + print(""); + } + print(""); + } + + print(""); + + $ttjml = $jmlkatpria + $jmlkatwanita + $jmlkatanak + $jmlkatsepatu; + $ttrp = $rpkatpria + $rpkatwanita + $rpkatanak + $rpkatsepatu; + $tthp = $hpkatpria + $hpkatwanita + $hpkatanak + $hpkatsepatu; + + print(" + + "); + + print("
Lini ProdukKedalaman ProdukJumlah BeliTotal HP
".$str[$i]['sepatu']."".$sub[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($ttJmlBeli['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp'], 0, ",", ".")."
Data Retur
".$strRet[$x]['sepatu']."".$sub[$x]['sepatu']."".number_format($jmlR[$x]['sepatu'], 0, ",", ".")."".number_format($rpR[$x]['sepatu'], 0, ",", ".")."
".number_format($ttJmlRetur['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['sepatu']['rp'], 0, ",", ".")."
Sub Total".number_format($jmlkatsepatu, 0, ",", ".")."".number_format($hpkatsepatu, 0, ",", ".")."
T O T A L : ".number_format($ttjml, 0, ",", ".")."".number_format($tthp, 0, ",", ".")."

"); + }else{ + echo "Belum ada data pembelian untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/lapbeliperkat.php~ b/old-source/LaporanBeli/lapbeliperkat.php~ new file mode 100644 index 0000000..c124f6d --- /dev/null +++ b/old-source/LaporanBeli/lapbeliperkat.php~ @@ -0,0 +1,306 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:700px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + + if(bukaKoneksi()){ + global $conn; + +// $query = "SELECT s.kel_jns, substr( d.kode_barang, 1, 2 ) lini, sum( d.jumlah ) jum , +// sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp +// FROM d_pembelian d +// INNER JOIN strip s ON ( s.kd_strip = substr( d.kode_barang, 1, 2 ) ) +// INNER JOIN m_pembelian m ON ( m.no_faktur = d.no_faktur ) +// WHERE m.no_faktur +// IN ( +// SELECT no_faktur +// FROM m_pembelian +// WHERE tgl_masuk +// BETWEEN '$startDate' AND '$endDate' +// )AND m.validasi = '1' +// GROUP BY s.kel_jns, substr( d.kode_barang, 1, 2 )"; + $query = "SELECT s.kel_jns,substr( d.kode_barang, 1, 2 ) lini,sum( d.jum_fisik ) jum, + sum(d.jum_fisik*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + FROM d_pembelian d, m_pembelian m,strip s + WHERE d.no_faktur = m.no_faktur + AND s.kd_strip = substr( d.kode_barang, 1, 2 ) + AND m.tgl_masuk BETWEEN '$startDate' AND '$endDate' AND m.validasi = '1' + GROUP BY s.kel_jns,substr( d.kode_barang, 1, 2 )"; +// $query2 ="SELECT s.kel_jns, substr( r.kd_barang, 1, 2 ) lini, sum( r.jumlah ) jum, sum( r.jumlah*r.harga_satuan ) hp +// FROM d_retur_beli r +// INNER JOIN strip s ON ( s.kd_strip = substr( r.kd_barang, 1, 2 ) ) +// INNER JOIN m_retur_beli m ON ( m.id_retur = r.id_retur ) +// WHERE m.tgl_retur +// BETWEEN '$startDate' AND '$endDate' AND m.validasi = '1' +// GROUP BY s.kel_jns, substr( r.kd_barang, 1, 2 )"; + $query2 = "SELECT s.kel_jns, substr( r.kd_barang, 1, 2 ) lini, sum( r.jumlah ) jum, + sum( r.jumlah*r.harga_satuan ) hp + FROM d_retur_beli r,strip s,m_retur_beli m + WHERE m.tgl_retur BETWEEN '$startDate' AND '$endDate' AND m.validasi = '1' + AND s.kd_strip = substr( r.kd_barang, 1, 2 ) + AND m.id_retur = r.id_retur + GROUP BY s.kel_jns, substr( r.kd_barang, 1, 2 )"; + + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cekR = mysqli_stmt_num_rows($stmt2); + if($cekR >= 0){//jika ada retur + mysqli_stmt_bind_result($stmt2,$kel,$str,$jmlRetur,$rpRetur); + + $priaR = 0; + $wanitaR = 0; + $anakR = 0; + $sepatuR = 0; + $strRet = array(); + $jmlR = array(); + $rpR = array(); + + $ttJmlRetur = array(); + $ttJmlRetur['pria']['jml'] = 0; + $ttJmlRetur['pria']['rp'] = 0; + $ttJmlRetur['wanita']['jml'] = 0; + $ttJmlRetur['wanita']['rp'] = 0; + $ttJmlRetur['anak']['jml'] = 0; + $ttJmlRetur['anak']['rp'] = 0; + $ttJmlRetur['sepatu']['jml'] = 0; + $ttJmlRetur['sepatu']['rp'] = 0; + + + while(mysqli_stmt_fetch($stmt2)){ + if($kel == 'P'){ + $strRet[$priaR]['pria'] = $str; + $jmlR[$priaR]['pria'] = $jmlRetur; + $rpR[$priaR]['pria'] = $rpRetur; + $ttJmlRetur['pria']['jml'] += $jmlRetur; + $ttJmlRetur['pria']['rp'] += $rpRetur; + $priaR++; + }elseif($kel == 'W'){ + $strRet[$wanitaR]['wanita'] = $str; + $jmlR[$wanitaR]['wanita'] = $jmlRetur; + $rpR[$wanitaR]['wanita'] = $rpRetur; + $ttJmlRetur['wanita']['jml'] += $jmlRetur; + $ttJmlRetur['wanita']['rp'] += $rpRetur; + $wanitaR++; + }elseif($kel == 'A'){ + $strRet[$anakR]['anak'] = $str; + $jmlR[$anakR]['anak'] = $jmlRetur; + $rpR[$anakR]['anak'] = $rpRetur; + $ttJmlRetur['anak']['jml'] += $jmlRetur; + $ttJmlRetur['anak']['rp'] += $rpRetur; + $anakR++; + }else{ + $strRet[$sepatuR]['sepatu'] = $str; + $jmlR[$sepatuR]['sepatu'] = $jmlRetur; + $rpR[$sepatuR]['sepatu'] = $rpRetur; + $ttJmlRetur['sepatu']['jml'] += $jmlRetur; + $ttJmlRetur['sepatu']['rp'] += $rpRetur; + $sepatuR++; + } + } + mysqli_stmt_free_result($stmt2); + mysqli_stmt_close($stmt2); + } + } + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek >= 0){ + mysqli_stmt_bind_result($stmt,$kelJns,$strip,$jmlBeli,$hrgPokok); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + + print("
"); + print("

Laporan Pembelian Per Kelompok Kategori



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PADA TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $str = array(); + $jmlB = array(); + $rpB = array(); + $HP = array(); + + while(mysqli_stmt_fetch($stmt)){ + if($jmlRetur == ''){ + $jmlRetur = 0; + } + if($rpRetur == ''){ + $rpRetur = 0; + } + if($kelJns == "P"){ + $kelJns = "Pria"; + $ttJmlBeli['pria']['jml'] += $jmlBeli; + $ttJmlBeli['pria']['hp'] += $hrgPokok; + $str[$pria]['pria'] = $strip; + $jmlB[$pria]['pria'] = $jmlBeli; + $rpB[$pria]['pria'] = $rpBeli; + $HP[$pria]['pria'] = $hrgPokok; + $pria++; + }elseif($kelJns == "W"){ + $kelJns = "Wanita"; + $ttJmlBeli['wanita']['jml'] += $jmlBeli; + $ttJmlBeli['wanita']['hp'] += $hrgPokok; + $str[$wanita]['wanita'] = $strip; + $jmlB[$wanita]['wanita'] = $jmlBeli; + $rpB[$wanita]['wanita'] = $rpBeli; + $HP[$wanita]['wanita'] = $hrgPokok; + $wanita++; + }elseif($kelJns == "A"){ + $kelJns = "Anak"; + $ttJmlBeli['anak']['jml'] += $jmlBeli; + $ttJmlBeli['anak']['hp'] += $hrgPokok; + $str[$anak]['anak'] = $strip; + $jmlB[$anak]['anak'] = $jmlBeli; + $rpB[$anak]['anak'] = $rpBeli; + $HP[$anak]['anak'] = $hrgPokok; + $anak++; + }else{ + $kelJns = "Sepatu"; + $ttJmlBeli['sepatu']['jml'] += $jmlBeli; + $ttJmlBeli['sepatu']['hp'] += $hrgPokok; + $str[$sepatu]['sepatu'] = $strip; + $jmlB[$sepatu]['sepatu'] = $jmlBeli; + $rpB[$sepatu]['sepatu'] = $rpBeli; + $HP[$sepatu]['sepatu'] = $hrgPokok; + $sepatu++; + } + + } + print(""); + print(""); + print("
"); + +/* PRIA -------------------------------------------------------------------------*/ + $jmlkatpria = $ttJmlBeli['pria']['jml']-$ttJmlRetur['pria']['jml']; + $hpkatpria = $ttJmlBeli['pria']['hp']-$ttJmlRetur['pria']['rp']; + + if($ttJmlBeli['pria']['jml']!=0){ + print("
"); + for($i=0;$i<$pria;$i++){ + print(""); + } + print(""); + } + + if($ttJmlRetur['pria']['jml']!= 0){ + print(""); + for($x=0;$x<$priaR;$x++){ + print(""); + } + print(""); + } + + print(""); +/* WANITA -------------------------------------------------------------------------*/ + $jmlkatwanita = $ttJmlBeli['wanita']['jml']-$ttJmlRetur['wanita']['jml']; + $hpkatwanita = $ttJmlBeli['wanita']['hp']-$ttJmlRetur['wanita']['rp']; + + if($ttJmlBeli['wanita']['jml']!=0){ + print(""); + for($i=0;$i<$wanita;$i++){ + print(""); + } + print(""); + } + + if($ttJmlRetur['wanita']['jml']!= 0){ + print(""); + for($x=0;$x<$wanitaR;$x++){ + print(""); + } + print(""); + } + + print(""); +/* ANAK -------------------------------------------------------------------------*/ + $jmlkatanak = $ttJmlBeli['anak']['jml']-$ttJmlRetur['anak']['jml']; + $hpkatanak = $ttJmlBeli['anak']['hp']-$ttJmlRetur['anak']['rp']; + + if($ttJmlBeli['anak']['jml']!=0){ + print(""); + for($i=0;$i<$anak;$i++){ + print(""); + } + print(""); + } + + if($ttJmlRetur['anak']['jml']!= 0){ + print(""); + for($x=0;$x<$anakR;$x++){ + print(""); + } + print(""); + } + + print(""); +/* SEPATU -------------------------------------------------------------------------*/ + $jmlkatsepatu = $ttJmlBeli['sepatu']['jml']-$ttJmlRetur['sepatu']['jml']; + $hpkatsepatu = $ttJmlBeli['sepatu']['hp']-$ttJmlRetur['sepatu']['rp']; + + if($ttJmlBeli['sepatu']['jml']!=0){ + print(""); + for($i=0;$i<$sepatu;$i++){ + print(""); + } + print(""); + } + + if($ttJmlRetur['sepatu']['jml']!= 0){ + print(""); + for($x=0;$x<$sepatuR;$x++){ + print(""); + } + print(""); + } + + print(""); + + $ttjml = $jmlkatpria + $jmlkatwanita + $jmlkatanak + $jmlkatsepatu; + $ttrp = $rpkatpria + $rpkatwanita + $rpkatanak + $rpkatsepatu; + $tthp = $hpkatpria + $hpkatwanita + $hpkatanak + $hpkatsepatu; + + print(" + + "); + + print("
KategoriLini ProdukJumlah BeliTotal HP
Pria
~".$str[$i]['pria']."".number_format($jmlB[$i]['pria'], 0, ",", ".")."".number_format($HP[$i]['pria'], 0, ",", ".")."
".number_format($ttJmlBeli['pria']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['hp'], 0, ",", ".")."
Retur Pria
~".$strRet[$x]['pria']."".number_format($jmlR[$x]['pria'], 0, ",", ".")."".number_format($rpR[$x]['pria'], 0, ",", ".")."
".number_format($ttJmlRetur['pria']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['pria']['rp'], 0, ",", ".")."
TOTAL PRIA".number_format($jmlkatpria, 0, ",", ".")."".number_format($hpkatpria, 0, ",", ".")."
Wanita
~".$str[$i]['wanita']."".number_format($jmlB[$i]['wanita'], 0, ",", ".")."".number_format($HP[$i]['wanita'], 0, ",", ".")."
".number_format($ttJmlBeli['wanita']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['hp'], 0, ",", ".")."
Retur Wanita
~".$strRet[$x]['wanita']."".number_format($jmlR[$x]['wanita'], 0, ",", ".")."".number_format($rpR[$x]['wanita'], 0, ",", ".")."
".number_format($ttJmlRetur['wanita']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['wanita']['rp'], 0, ",", ".")."
TOTAL wanita".number_format($jmlkatwanita, 0, ",", ".")."".number_format($hpkatwanita, 0, ",", ".")."
Anak
~".$str[$i]['anak']."".number_format($jmlB[$i]['anak'], 0, ",", ".")."".number_format($HP[$i]['anak'], 0, ",", ".")."
".number_format($ttJmlBeli['anak']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['hp'], 0, ",", ".")."
Retur Anak
~".$strRet[$x]['anak']."".number_format($jmlR[$x]['anak'], 0, ",", ".")."".number_format($rpR[$x]['anak'], 0, ",", ".")."
".number_format($ttJmlRetur['anak']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['anak']['rp'], 0, ",", ".")."
TOTAL Anak".number_format($jmlkatanak, 0, ",", ".")."".number_format($hpkatanak, 0, ",", ".")."
Sepatu
~".$str[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($ttJmlBeli['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp'], 0, ",", ".")."
Retur Sepatu
~".$strRet[$x]['sepatu']."".number_format($jmlR[$x]['sepatu'], 0, ",", ".")."".number_format($rpR[$x]['sepatu'], 0, ",", ".")."
".number_format($ttJmlRetur['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['sepatu']['rp'], 0, ",", ".")."
TOTAL Sepatu".number_format($jmlkatsepatu, 0, ",", ".")."".number_format($hpkatsepatu, 0, ",", ".")."
T O T A L : ".number_format($ttjml, 0, ",", ".")."".number_format($tthp, 0, ",", ".")."

"); + }else{ + echo "Belum ada data pembelian untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/lapbelipersup.php b/old-source/LaporanBeli/lapbelipersup.php new file mode 100644 index 0000000..ef5275b --- /dev/null +++ b/old-source/LaporanBeli/lapbelipersup.php @@ -0,0 +1,297 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:700px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $kdsupp = ($_POST['kdsupp']); + + if(bukaKoneksi()){ + global $conn; + if ($kdsupp!=""){ + $query ="SELECT s.kel_jns,s.nama_strip, m.kd_supplier, u.nama_supplier, + sum( d.jum_fisik ) jum, + sum(d.jum_fisik*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + FROM d_pembelian d, m_pembelian m, supplier u,strip s, barang b + WHERE d.no_faktur = m.no_faktur + AND b.kode_barang = d.kode_barang + AND s.kd_strip = b.kode_strip + AND u.kd_supplier = m.kd_supplier + AND m.tgl_masuk BETWEEN '$startDate' AND '$endDate' + AND u.kd_supplier = '$kdsupp' + AND m.validasi = '1' + AND m.status_revisi = '1' + GROUP BY b.kode_strip , m.kd_supplier"; + + $query2 ="SELECT s.kel_jns,s.nama_strip, m.kd_supplier, u.nama_supplier, + sum( d.jumlah ) jum,sum(d.jumlah*d.harga_satuan) hp + FROM d_retur_beli d, m_retur_beli m, supplier u,strip s , barang b + WHERE d.id_retur = m.id_retur + AND b.kode_barang = d.kd_barang + AND s.kd_strip = b.kode_strip + AND u.kd_supplier = m.kd_supplier + AND m.tgl_retur BETWEEN '$startDate' AND '$endDate' + AND u.kd_supplier = '$kdsupp' + AND m.validasi = '1' + GROUP BY b.kode_strip , m.kd_supplier"; + + }else { + $query ="SELECT s.kel_jns,s.nama_strip, m.kd_supplier, u.nama_supplier, + sum( d.jum_fisik ) jum, + sum(d.jum_fisik*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + FROM d_pembelian d, m_pembelian m, supplier u,strip s, barang b + WHERE d.no_faktur = m.no_faktur + AND b.kode_barang = d.kode_barang + AND s.kd_strip = b.kode_strip + AND u.kd_supplier = m.kd_supplier + AND m.tgl_masuk BETWEEN '$startDate' AND '$endDate' + AND m.validasi = '1' + AND m.status_revisi = '1' + GROUP BY b.kode_strip , m.kd_supplier"; + + $query2 ="SELECT s.kel_jns,s.nama_strip, m.kd_supplier, u.nama_supplier, + sum( d.jumlah ) jum,sum(d.jumlah*d.harga_satuan) hp + FROM d_retur_beli d, m_retur_beli m, supplier u,strip s, barang b + WHERE d.id_retur = m.id_retur + AND b.kode_barang = d.kd_barang + AND s.kd_strip = b.kode_strip + AND u.kd_supplier = m.kd_supplier + AND m.tgl_retur BETWEEN '$startDate' AND '$endDate' AND m.validasi = '1' + GROUP BY b.kode_strip , m.kd_supplier"; + } + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cekR = mysqli_stmt_num_rows($stmt2); + if($cekR >= 0){//jika ada retur + mysqli_stmt_bind_result($stmt2,$kel,$str,$kdsup,$nmsup,$jmlRetur,$rpRetur); + + $priaR = 0; + $wanitaR = 0; + $anakR = 0; + $sepatuR = 0; + $strRet = array(); + $jmlR = array(); + $rpR = array(); + + $ttJmlRetur = array(); + $ttJmlRetur['pria']['jml'] = 0; + $ttJmlRetur['pria']['rp'] = 0; + $ttJmlRetur['wanita']['jml'] = 0; + $ttJmlRetur['wanita']['rp'] = 0; + $ttJmlRetur['anak']['jml'] = 0; + $ttJmlRetur['anak']['rp'] = 0; + $ttJmlRetur['sepatu']['jml'] = 0; + $ttJmlRetur['sepatu']['rp'] = 0; + + + while(mysqli_stmt_fetch($stmt2)){ + if($kel == 'P'){ + $strRet[$priaR]['pria'] = $str; + $jmlR[$priaR]['pria'] = $jmlRetur; + $rpR[$priaR]['pria'] = $rpRetur; + $ttJmlRetur['pria']['jml'] += $jmlRetur; + $ttJmlRetur['pria']['rp'] += $rpRetur; + $kdSupplier[$priaR]['pria'] = $kdsup; + $nmSupplier[$priaR]['pria'] = $nmsup; + $priaR++; + }elseif($kel == 'W'){ + $strRet[$wanitaR]['wanita'] = $str; + $jmlR[$wanitaR]['wanita'] = $jmlRetur; + $rpR[$wanitaR]['wanita'] = $rpRetur; + $ttJmlRetur['wanita']['jml'] += $jmlRetur; + $ttJmlRetur['wanita']['rp'] += $rpRetur; + $kdSupplier[$wanitaR]['wanita'] = $kdsup; + $nmSupplier[$wanitaR]['wanita'] = $nmsup; + $wanitaR++; + }elseif($kel == 'A'){ + $strRet[$anakR]['anak'] = $str; + $jmlR[$anakR]['anak'] = $jmlRetur; + $rpR[$anakR]['anak'] = $rpRetur; + $ttJmlRetur['anak']['jml'] += $jmlRetur; + $ttJmlRetur['anak']['rp'] += $rpRetur; + $kdSupplier[$anakR]['anak'] = $kdsup; + $nmSupplier[$anakR]['anak'] = $nmsup; + $anakR++; + }else{ + $strRet[$sepatuR]['sepatu'] = $str; + $jmlR[$sepatuR]['sepatu'] = $jmlRetur; + $rpR[$sepatuR]['sepatu'] = $rpRetur; + $ttJmlRetur['sepatu']['jml'] += $jmlRetur; + $ttJmlRetur['sepatu']['rp'] += $rpRetur; + $kdSupplier[$sepatuR]['sepatu'] = $kdsup; + $nmSupplier[$sepatuR]['sepatu'] = $nmsup; + $sepatuR++; + } + } + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_free_result($stmt2); + mysqli_stmt_close($stmt2); + } + } + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek >= 0){ + mysqli_stmt_bind_result($stmt,$kelJns,$strip,$kd,$nm,$jmlBeli,$hrgPokok); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + + print("
"); + print("

Laporan Pembelian Per Supllier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PADA TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $str = array(); + $jmlB = array(); + $rpB = array(); + $HP = array(); + + while(mysqli_stmt_fetch($stmt)){ + if($jmlRetur == ''){ + $jmlRetur = 0; + } + if($rpRetur == ''){ + $rpRetur = 0; + } + if($kelJns == "P"){ + $kelJns = "Pria"; + $ttJmlBeli['pria']['jml'] += $jmlBeli; + $ttJmlBeli['pria']['hp'] += $hrgPokok; + $str[$pria]['pria'] = $strip; + $jmlB[$pria]['pria'] = $jmlBeli; + $rpB[$pria]['pria'] = $rpBeli; + $HP[$pria]['pria'] = $hrgPokok; + $kdSupp[$pria]['pria'] = $kd; + $nmSupp[$pria]['pria'] = $nm; + $pria++; + }elseif($kelJns == "W"){ + $kelJns = "Wanita"; + $ttJmlBeli['wanita']['jml'] += $jmlBeli; + $ttJmlBeli['wanita']['hp'] += $hrgPokok; + $str[$wanita]['wanita'] = $strip; + $jmlB[$wanita]['wanita'] = $jmlBeli; + $rpB[$wanita]['wanita'] = $rpBeli; + $HP[$wanita]['wanita'] = $hrgPokok; + $kdSupp[$wanita]['wanita'] = $kd; + $nmSupp[$wanita]['wanita'] = $nm; + $wanita++; + }elseif($kelJns == "A"){ + $kelJns = "Anak"; + $ttJmlBeli['anak']['jml'] += $jmlBeli; + $ttJmlBeli['anak']['hp'] += $hrgPokok; + $str[$anak]['anak'] = $strip; + $jmlB[$anak]['anak'] = $jmlBeli; + $rpB[$anak]['anak'] = $rpBeli; + $HP[$anak]['anak'] = $hrgPokok; + $kdSupp[$anak]['anak'] = $kd; + $nmSupp[$anak]['anak'] = $nm; + $anak++; + }else{ + $kelJns = "Sepatu"; + $ttJmlBeli['sepatu']['jml'] += $jmlBeli; + $ttJmlBeli['sepatu']['hp'] += $hrgPokok; + $str[$sepatu]['sepatu'] = $strip; + $jmlB[$sepatu]['sepatu'] = $jmlBeli; + $rpB[$sepatu]['sepatu'] = $rpBeli; + $HP[$sepatu]['sepatu'] = $hrgPokok; + $kdSupp[$sepatu]['sepatu'] = $kd; + $nmSupp[$sepatu]['sepatu'] = $nm; + $sepatu++; + } + + } + print(""); + print(""); + print("
"); + +/* SEPATU -------------------------------------------------------------------------*/ + $jmlkatsepatu = $ttJmlBeli['sepatu']['jml']-$ttJmlRetur['sepatu']['jml']; + $hpkatsepatu = $ttJmlBeli['sepatu']['hp']-$ttJmlRetur['sepatu']['rp']; + + if($ttJmlBeli['sepatu']['jml']!=0){ + print("
"); + for($i=0;$i<$sepatu;$i++){ + if ($str[$i-1]['sepatu']==$str[$i]['sepatu']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlah4 = 0; + $temphp4 = 0; + } + $tempjumlah4 += $jmlB[$i]['sepatu']; + $temphp4 += $HP[$i]['sepatu']; + } + print(""); + print(""); + } + + if($ttJmlRetur['sepatu']['jml']!= 0){ + print(""); + for($x=0;$x<$sepatuR;$x++){ + if ($strRet[$x-1]['sepatu']==$strRet[$x]['sepatu']){ + print(""); + }else{ + print(""); + print(""); + + $tmpjmlR4 = 0; + $tmprpR4 = 0; + } + $tmpjmlR4 += $jmlR[$x]['sepatu']; + $tmprpR4 += $rpR[$x]['sepatu']; + } + print(""); + print(""); + } + print(""); + + $ttjml = $jmlkatpria + $jmlkatwanita + $jmlkatanak + $jmlkatsepatu; + $ttrp = $rpkatpria + $rpkatwanita + $rpkatanak + $rpkatsepatu; + $tthp = $hpkatpria + $hpkatwanita + $hpkatanak + $hpkatsepatu; + + print(" + + "); + + print("
Lini ProdukKode SupplierNama SupplierJumlah BeliTotal HP
".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlah4, 0, ",", ".")."".number_format($temphp4, 0, ",", ".")."
".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlah4, 0, ",", ".")."".number_format($temphp4, 0, ",", ".")."
SUB TOTAL".number_format($ttJmlBeli['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp'], 0, ",", ".")."
Data Retur
".$strRet[$x]['sepatu'].".".$kdSupplier[$x]['sepatu']."".$nmSupplier[$x]['sepatu']."".number_format($jmlR[$x]['sepatu'], 0, ",", ".")."".number_format($rpR[$x]['sepatu'], 0, ",", ".")."
".number_format($tmpjmlR4, 0, ",", ".")."".number_format($tmprpR4, 0, ",", ".")."
".$strRet[$x]['sepatu'].".".$kdSupplier[$x]['sepatu']."".$nmSupplier[$x]['sepatu']."".number_format($jmlR[$x]['sepatu'], 0, ",", ".")."".number_format($rpR[$x]['sepatu'], 0, ",", ".")."
".number_format($tmpjmlR4, 0, ",", ".")."".number_format($tmprpR4, 0, ",", ".")."
SUB TOTAL".number_format($ttJmlRetur['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlRetur['sepatu']['rp'], 0, ",", ".")."
Sub Total".number_format($jmlkatsepatu, 0, ",", ".")."".number_format($hpkatsepatu, 0, ",", ".")."
T O T A L : ".number_format($ttjml, 0, ",", ".")."".number_format($tthp, 0, ",", ".")."

"); + }else{ + echo "Tidak ada data pembelian untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/lapbelirevisi.php b/old-source/LaporanBeli/lapbelirevisi.php new file mode 100644 index 0000000..d77ac99 --- /dev/null +++ b/old-source/LaporanBeli/lapbelirevisi.php @@ -0,0 +1,74 @@ +"; + echo "div#divprint{width:900px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:850px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + + if(bukaKoneksi()){ + global $conn; + $query = "SELECT m.no_faktur, m.tgl_masuk, m.kd_supplier, s.nama_supplier, m.total_beli, m.rp_beli,k.nama,m.referensi,m.keterangan + FROM m_pembelian m, supplier s, karyawan k + WHERE s.kd_supplier = m.kd_supplier + AND m.nik = k.nik + AND m.validasi = '1' + AND left(m.no_faktur,4) = 'RVB-' + AND m.status_revisi = 0 + AND m.tgl_masuk between '$startDate' AND '$endDate' + ORDER BY m.tgl_masuk,m.kd_supplier"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$faktur,$tglMsk,$kdSup,$nmSup,$ttBeli,$ttRp,$nama,$nota_asl,$ket); + $ttJumlah = array(); + $ttJumlah['jml'] = 0; + $ttJumlah['rp'] = 0; + + print("
"); + print("

Laporan Revisi Pembelian



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['jml'] += $ttBeli; + $ttJumlah['rp'] += $ttRp; + print(""); + } + + print("
No. FakturTanggal RevisiKode Supp.Nama SupplierJumlah BeliTotal BeliNamaNota AsliAlasan Revisi
.$faktur".encTgl($tglMsk).".$kdSup$nmSup".number_format($ttBeli,0,',','.')."".number_format($ttRp,0,',','.')."$nama$nota_asl$ket

"); + print("
"); + + print(""); + print(""); + + print("
Total Jumlah Revisi Pembelian : ".number_format($ttJumlah['jml'],0,',','.')."
Total Rupiah Revisi Pembelian : ".number_format($ttJumlah['rp'],0,',','.')."
"); + }else{ + echo "Belum ada data revisi-an untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/lapexpdate.php b/old-source/LaporanBeli/lapexpdate.php new file mode 100644 index 0000000..5716589 --- /dev/null +++ b/old-source/LaporanBeli/lapexpdate.php @@ -0,0 +1,71 @@ +"; + echo "div#divprint{width:1024px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:950px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:50px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + if(bukaKoneksi()){ + global $conn; + + + $query = "SELECT s.nama_strip,k.ked_produk,d.exp_date,m.`tgl_nota`,d.no_faktur,sp.nama_supplier,d.kode_barang,d.kode_asli,d.nm_brg, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp,d.jum_fisik,n.stok + FROM m_pembelian m, d_pembelian d, strip s, barang b, no_barang n, kedalaman_produk k, supplier sp + WHERE + d.no_faktur = m.no_faktur + AND d.kode_barang = b.kode_barang + AND b.id_gabungan = n.id_gabungan + AND b.kode_strip = s.kd_strip + AND b.kode_supplier = sp.kd_supplier + AND (b.kode_strip = k.kode_strip AND b.ked_produk = k.kode_ked_produk) + AND d.exp_date between '$startDate' and '$endDate' + ORDER BY b.kode_strip,b.ked_produk,d.exp_date"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$str,$ked,$exp,$tglnota,$faktur,$nmsupp,$kdbrg,$barcode,$nmbrg,$hp,$jbeli,$stok); + + print("
"); + print("

Laporan Barang Expired



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE EXPIRED: ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(" + + "); + + while(mysqli_stmt_fetch($stmt)){ + print(" + "); + } + + print("
GroupSub GroupTgl.ExpiredTgl.NotaNo.FakturNama SupplierKode BrgBarcodeNama BrgHPJum BeliStok
$str$ked".encTgl($exp)."".encTgl($tglnota).".$faktur$nmsupp$kdbrg$barcode$nmbrg".number_format($hp,0,",",".")."$jbeli$stok

"); + print("
"); + }else{ + echo "Belum ada data barang expired untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/lapgrouppersup.php b/old-source/LaporanBeli/lapgrouppersup.php new file mode 100644 index 0000000..b83a894 --- /dev/null +++ b/old-source/LaporanBeli/lapgrouppersup.php @@ -0,0 +1,115 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:700px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate2']); + $endDate = decTgl($_POST['endDate2']); + + + if(bukaKoneksi()){ + global $conn; + + /*----------------------------------------Pembelian grouping per supplier*/ + $query = "SELECT m.kd_supplier, u.nama_supplier, + sum( d.jum_fisik ) jum, + sum(d.jum_fisik*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + FROM d_pembelian d, m_pembelian m, barang b, supplier u,strip s + WHERE d.no_faktur = m.no_faktur + AND d.kode_barang = b.kode_barang + AND s.kd_strip = b.kode_strip + AND u.kd_supplier = m.kd_supplier + AND m.tgl_masuk BETWEEN '$startDate' AND '$endDate' + AND m.validasi = '1' + AND m.status_revisi = '1' + GROUP BY m.kd_supplier"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdsupp,$supp,$jml,$hp); + + print("
"); + print("

Rekap Pembelian Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("TANGGAL MASUK : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."


"); + print(""); + print(" + "); + + $ttHP = 0; + while(mysqli_stmt_fetch($stmt)){ + $ttHP += $hp; + print(""); + } + print(""); + print("
Kode SupplierNama SupplierJumlHarga Pokok
.$kdsupp$supp$jml".number_format($hp,0,',','.')."
Total HP Beli".number_format($ttHP,0,',','.')."

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + /*----------------------------------------Retur grouping per supplier*/ + $query2 = "SELECT m.kd_supplier, u.nama_supplier, + sum( d.jumlah ) jum,sum(d.jumlah*d.harga_satuan) hp + FROM d_retur_beli d, m_retur_beli m, supplier u,strip s + WHERE d.id_retur = m.id_retur + AND s.kd_strip = substr( d.kd_barang, 1, 2 ) + AND u.kd_supplier = m.kd_supplier + AND m.tgl_retur BETWEEN '$startDate' AND '$endDate' + AND m.validasi = '1' + GROUP BY m.kd_supplier"; + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$kdsupp2,$supp2,$jml2,$hp2); + + print("
"); + print("

Rekap Retur Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("TANGGAL MASUK : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."


"); + print(""); + print(" + "); + + $ttHP2 = 0; + while(mysqli_stmt_fetch($stmt2)){ + $ttHP2 += $hp2; + print(""); + } + print(""); + print("
Kode SupplierNama SupplierJumlHarga Pokok
.$kdsupp2$supp2$jml2".number_format($hp2,0,',','.')."
Total HP Retur".number_format($ttHP2,0,',','.')."

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + print("

"); + } + +?> diff --git a/old-source/LaporanBeli/lapobd.php~ b/old-source/LaporanBeli/lapobd.php~ new file mode 100644 index 0000000..0962aad --- /dev/null +++ b/old-source/LaporanBeli/lapobd.php~ @@ -0,0 +1,356 @@ +"; + echo "div#divprint{width:1024px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:950px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".warnaKolPisah{font-weight : bold; background-color: #595454;}"; //#413839 + echo ".master{text-align:left;}"; + echo ""; + + $startDate = $_POST['startDate']; //kd supp + $endDate = $_POST['endDate']; // lini + $bln = $_POST['bulan']; + $thn = $_POST['tahun']; + + if(bukaKoneksi()){ + global $conn; + + if ($startDate != '' and $endDate != '' and $bln != '' and $thn != ''){ + $query = "SELECT A.kel_jns,A.kode_strip,A.kd_supplier,A.nama_supplier,A.jml jmlOrder,A.rp rpOrder,B.jml jmlBeli,B.rp rpBeli + FROM + (SELECT s.kel_jns,d.kode_strip,m.kd_supplier, u.nama_supplier,sum(d.jumlah) jml,sum(d.harga_order) rp + from d_order d,m_order m,supplier u,strip s + where d.no_order = m.no_order + AND s.kd_strip = d.kode_strip + AND u.kd_supplier = m.kd_supplier + AND month(rencana_datang) = '$bln' AND year(rencana_datang) = '$thn' + group by d.kode_strip,m.kd_supplier) A + LEFT JOIN + (SELECT s.kel_jns,left(d.kode_barang,2) lini,m.kd_supplier, u.nama_supplier,sum(d.jum_fisik) jml,sum(d.harga_satuan) rp + from d_pembelian d,m_pembelian m,supplier u,strip s + where d.no_faktur = m.no_faktur + AND s.kd_strip = left(d.kode_barang,2) + AND u.kd_supplier = m.kd_supplier + AND month(tgl_masuk) = '$bln' AND year(tgl_masuk) = '$thn' + group by left(d.kode_barang,2),m.kd_supplier) B + ON A.kode_strip = B.lini + AND A.kd_supplier = B.kd_supplier + WHERE A.kd_supplier = '$startDate' AND A.kode_strip = '$endDate' "; + }else if ($startDate != '' and $bln != '' and $thn != ''){ + $query = "SELECT A.kel_jns,A.kode_strip,A.kd_supplier,A.nama_supplier,A.jml jmlOrder,A.rp rpOrder,B.jml jmlBeli,B.rp rpBeli + FROM + (SELECT s.kel_jns,d.kode_strip,m.kd_supplier, u.nama_supplier,sum(d.jumlah) jml,sum(d.harga_order) rp + from d_order d,m_order m,supplier u,strip s + where d.no_order = m.no_order + AND s.kd_strip = d.kode_strip + AND u.kd_supplier = m.kd_supplier + AND month(rencana_datang) = '$bln' AND year(rencana_datang) = '$thn' + group by d.kode_strip,m.kd_supplier) A + LEFT JOIN + (SELECT s.kel_jns,left(d.kode_barang,2) lini,m.kd_supplier, u.nama_supplier,sum(d.jum_fisik) jml,sum(d.harga_satuan) rp + from d_pembelian d,m_pembelian m,supplier u,strip s + where d.no_faktur = m.no_faktur + AND s.kd_strip = left(d.kode_barang,2) + AND u.kd_supplier = m.kd_supplier + AND month(tgl_masuk) = '$bln' AND year(tgl_masuk) = '$thn' + group by left(d.kode_barang,2),m.kd_supplier) B + ON A.kode_strip = B.lini + AND A.kd_supplier = B.kd_supplier + WHERE A.kd_supplier = '$startDate' "; + }else if ($endDate != '' and $bln != '' and $thn != ''){ + $query = "SELECT A.kel_jns,A.kode_strip,A.kd_supplier,A.nama_supplier,A.jml jmlOrder,A.rp rpOrder,B.jml jmlBeli,B.rp rpBeli + FROM + (SELECT s.kel_jns,d.kode_strip,m.kd_supplier, u.nama_supplier,sum(d.jumlah) jml,sum(d.harga_order) rp + from d_order d,m_order m,supplier u,strip s + where d.no_order = m.no_order + AND s.kd_strip = d.kode_strip + AND u.kd_supplier = m.kd_supplier + AND month(rencana_datang) = '$bln' AND year(rencana_datang) = '$thn' + group by d.kode_strip,m.kd_supplier) A + LEFT JOIN + (SELECT s.kel_jns,left(d.kode_barang,2) lini,m.kd_supplier, u.nama_supplier,sum(d.jum_fisik) jml,sum(d.harga_satuan) rp + from d_pembelian d,m_pembelian m,supplier u,strip s + where d.no_faktur = m.no_faktur + AND s.kd_strip = left(d.kode_barang,2) + AND u.kd_supplier = m.kd_supplier + AND month(tgl_masuk) = '$bln' AND year(tgl_masuk) = '$thn' + group by left(d.kode_barang,2),m.kd_supplier) B + ON A.kode_strip = B.lini + AND A.kd_supplier = B.kd_supplier + WHERE A.kode_strip = '$endDate' "; + }else{ + $query = "SELECT A.kel_jns,A.kode_strip,A.kd_supplier,A.nama_supplier,A.jml jmlOrder,A.rp rpOrder,B.jml jmlBeli,B.rp rpBeli + FROM + (SELECT s.kel_jns,d.kode_strip,m.kd_supplier, u.nama_supplier,sum(d.jumlah) jml,sum(d.harga_order) rp + from d_order d,m_order m,supplier u,strip s + where d.no_order = m.no_order + AND s.kd_strip = d.kode_strip + AND u.kd_supplier = m.kd_supplier + AND month(rencana_datang) = '$bln' AND year(rencana_datang) = '$thn' + group by d.kode_strip,m.kd_supplier) A + LEFT JOIN + (SELECT s.kel_jns,left(d.kode_barang,2) lini,m.kd_supplier, u.nama_supplier,sum(d.jum_fisik) jml,sum(d.harga_satuan) rp + from d_pembelian d,m_pembelian m,supplier u,strip s + where d.no_faktur = m.no_faktur + AND s.kd_strip = left(d.kode_barang,2) + AND u.kd_supplier = m.kd_supplier + AND month(tgl_masuk) = '$bln' AND year(tgl_masuk) = '$thn' + group by left(d.kode_barang,2),m.kd_supplier) B + ON A.kode_strip = B.lini + AND A.kd_supplier = B.kd_supplier "; + } + + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek >= 0){ + mysqli_stmt_bind_result($stmt,$kelJns,$strip,$kd,$nm,$vrenc,$hprenc,$vrev,$hprev); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['pria']['jmlRev'] = 0; + $ttJmlBeli['pria']['hpRev'] = 0; + + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['wanita']['jmlRev'] = 0; + $ttJmlBeli['wanita']['hpRev'] = 0; + + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['anak']['jmlRev'] = 0; + $ttJmlBeli['anak']['hpRev'] = 0; + + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + $ttJmlBeli['sepatu']['jmlRev'] = 0; + $ttJmlBeli['sepatu']['hpRev'] = 0; + + print("
"); + print("

Laporan Order Belum Datang



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."

"); + print("Bulan Order : ".$bln."
"); + print("Tahun Order : ".$_POST['tahun']."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $str = array(); + $jmlren = array(); + $rpren = array(); + $stsren = array(); + $jmlrev = array(); + $rprev = array(); + $stsrev = array(); + + while(mysqli_stmt_fetch($stmt)){ + if($kelJns == "P"){ + $kelJns = "Pria"; + $ttJmlBeli['pria']['jml'] += $vrenc; + $ttJmlBeli['pria']['hp'] += $hprenc; + $ttJmlBeli['pria']['jmlRev'] += $vrev; + $ttJmlBeli['pria']['hpRev'] += $hprev; + $str[$pria]['pria'] = $strip; + $jmlren[$pria]['pria'] = $vrenc; + $rpren[$pria]['pria'] = $hprenc; + $stsren[$pria]['pria'] = $statrenc; + $jmlrev[$pria]['pria'] = $vrev; + $rprev[$pria]['pria'] = $hprev; + $stsrev[$pria]['pria'] = $statrev; + $kdSupp[$pria]['pria'] = $kd; + $nmSupp[$pria]['pria'] = $nm; + $noord[$pria]['pria'] = $noorder; + $pria++; + }elseif($kelJns == "W"){ + $kelJns = "Wanita"; + $ttJmlBeli['wanita']['jml'] += $vrenc; + $ttJmlBeli['wanita']['hp'] += $hprenc; + $ttJmlBeli['wanita']['jmlRev'] += $vrev; + $ttJmlBeli['wanita']['hpRev'] += $hprev; + $str[$wanita]['wanita'] = $strip; + $jmlren[$wanita]['wanita'] = $vrenc; + $rpren[$wanita]['wanita'] = $hprenc; + $stsren[$wanita]['wanita'] = $statrenc; + $jmlrev[$wanita]['wanita'] = $vrev; + $rprev[$wanita]['wanita'] = $hprev; + $stsrev[$wanita]['wanita'] = $statrev; + $kdSupp[$wanita]['wanita'] = $kd; + $nmSupp[$wanita]['wanita'] = $nm; + $noord[$wanita]['wanita'] = $noorder; + $wanita++; + }elseif($kelJns == "A"){ + $kelJns = "Anak"; + $ttJmlBeli['anak']['jml'] += $vrenc; + $ttJmlBeli['anak']['hp'] += $hprenc; + $ttJmlBeli['anak']['jmlRev'] += $vrev; + $ttJmlBeli['anak']['hpRev'] += $hprev; + $str[$anak]['anak'] = $strip; + $jmlren[$anak]['anak'] = $vrenc; + $rpren[$anak]['anak'] = $hprenc; + $stsren[$anak]['anak'] = $statrenc; + $jmlrev[$anak]['anak'] = $vrev; + $rprev[$anak]['anak'] = $hprev; + $stsrev[$anak]['anak'] = $statrev; + $kdSupp[$anak]['anak'] = $kd; + $nmSupp[$anak]['anak'] = $nm; + $noord[$anak]['anak'] = $noorder; + $anak++; + }else{ + $kelJns = "Sepatu"; + $ttJmlBeli['sepatu']['jml'] += $vrenc; + $ttJmlBeli['sepatu']['hp'] += $hprenc; + $ttJmlBeli['sepatu']['jmlRev'] += $vrev; + $ttJmlBeli['sepatu']['hpRev'] += $hprev; + $str[$sepatu]['sepatu'] = $strip; + $jmlren[$sepatu]['sepatu'] = $vrenc; + $rpren[$sepatu]['sepatu'] = $hprenc; + $stsren[$sepatu]['sepatu'] = $statrenc; + $jmlrev[$sepatu]['sepatu'] = $vrev; + $rprev[$sepatu]['sepatu'] = $hprev; + $stsrev[$sepatu]['sepatu'] = $statrev; + $kdSupp[$sepatu]['sepatu'] = $kd; + $nmSupp[$sepatu]['sepatu'] = $nm; + $noord[$sepatu]['sepatu'] = $noorder; + $sepatu++; + } + + } + print(""); + print(""); + print("
"); + +/* PRIA -------------------------------------------------------------------------*/ + if($ttJmlBeli['pria']['jml']!=0){ + print("
"); + for($i=0;$i<$pria;$i++){ + if ($str[$i-1]['pria']==$str[$i]['pria']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlah1 = 0; + $temphp1 = 0; + $tempjumlah2 = 0; + $temphp2 = 0; + } + $tempjumlah1 += $jmlren[$i]['pria']; + $temphp1 += $rpren[$i]['pria']; + $tempjumlah2 += $jmlrev[$i]['pria']; + $temphp2 += $rprev[$i]['pria']; + + } + print(""); + } + + print(""); + +/* WANITA -------------------------------------------------------------------------*/ + if($ttJmlBeli['wanita']['jml']!=0){ + print(""); + for($i=0;$i<$wanita;$i++){ + if ($str[$i-1]['wanita']==$str[$i]['wanita']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlah3 = 0; + $temphp3 = 0; + $tempjumlah4 = 0; + $temphp4 = 0; + } + $tempjumlah3 += $jmlren[$i]['wanita']; + $temphp3 += $rpren[$i]['wanita']; + $tempjumlah4 += $jmlrev[$i]['wanita']; + $temphp4 += $rprev[$i]['wanita']; + + } + print(""); + } + + print(""); +/* ANAK -------------------------------------------------------------------------*/ + if($ttJmlBeli['anak']['jml']!=0){ + print(""); + for($i=0;$i<$anak;$i++){ + if ($str[$i-1]['anak']==$str[$i]['anak']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlah5 = 0; + $temphp5 = 0; + $tempjumlah6 = 0; + $temphp6 = 0; + } + $tempjumlah5 += $jmlren[$i]['anak']; + $temphp5 += $rpren[$i]['anak']; + $tempjumlah6 += $jmlrev[$i]['anak']; + $temphp6 += $rprev[$i]['anak']; + + } + print(""); + } + + print(""); +/* SEPATU -------------------------------------------------------------------------*/ + if($ttJmlBeli['sepatu']['jml']!=0){ + print(""); + for($i=0;$i<$sepatu;$i++){ + if ($str[$i-1]['sepatu']==$str[$i]['sepatu']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlah7 = 0; + $temphp7 = 0; + $tempjumlah8 = 0; + $temphp8 = 0; + } + $tempjumlah7 += $jmlren[$i]['sepatu']; + $temphp7 += $rpren[$i]['sepatu']; + $tempjumlah8 += $jmlrev[$i]['sepatu']; + $temphp8 += $rprev[$i]['sepatu']; + + } + print(""); + } + + print(""); + + $ttjml1 = $ttJmlBeli['pria']['jml'] + $ttJmlBeli['wanita']['jml'] + $ttJmlBeli['anak']['jml'] + $ttJmlBeli['sepatu']['jml']; + $ttrp1 = $ttJmlBeli['pria']['hp'] + $ttJmlBeli['wanita']['hp'] + $ttJmlBeli['anak']['hp'] + $ttJmlBeli['sepatu']['hp']; + $ttjml2 = $ttJmlBeli['pria']['jmlRev'] + $ttJmlBeli['wanita']['jmlRev'] + $ttJmlBeli['anak']['jmlRev'] + $ttJmlBeli['sepatu']['jmlRev']; + $ttrp2 = $ttJmlBeli['pria']['hpRev'] + $ttJmlBeli['wanita']['hpRev'] + $ttJmlBeli['anak']['hpRev'] + $ttJmlBeli['sepatu']['hpRev']; + + print(" + + + + "); + + print("
KategoriLini ProdukKode SupplierNama SupplierJumlah OrderTotal HP Order Jml PenerimaanTotal HP PenerimaanJml OBDTotal HP OBD
Pria
~".$str[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")."".number_format($jmlren[$i]['pria']-$jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria']-$rprev[$i]['pria'], 0, ",", ".")."
".number_format($tempjumlah1, 0, ",", ".")."".number_format($temphp1, 0, ",", ".")."".number_format($tempjumlah2, 0, ",", ".")."".number_format($temphp2, 0, ",", ".")."".number_format($tempjumlah1-$tempjumlah2, 0, ",", ".")."".number_format($temphp1-$temphp2, 0, ",", ".")."
~".$str[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")."".number_format($jmlren[$i]['pria']-$jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria']-$rprev[$i]['pria'], 0, ",", ".")."
".number_format($tempjumlah1, 0, ",", ".")."".number_format($temphp1, 0, ",", ".")."".number_format($tempjumlah2, 0, ",", ".")."".number_format($temphp2, 0, ",", ".")."".number_format($tempjumlah1-$tempjumlah2, 0, ",", ".")."".number_format($temphp1-$temphp2, 0, ",", ".")."
TOTAL PRIA".number_format($ttJmlBeli['pria']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['hp'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['hpRev'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['jml']-$ttJmlBeli['pria']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['hp']-$ttJmlBeli['pria']['hpRev'], 0, ",", ".")."
Wanita
~".$str[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")."".number_format($jmlren[$i]['wanita']-$jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita']-$rprev[$i]['wanita'], 0, ",", ".")."
".number_format($tempjumlah3, 0, ",", ".")."".number_format($temphp3, 0, ",", ".")."".number_format($tempjumlah4, 0, ",", ".")."".number_format($temphp4, 0, ",", ".")."".number_format($tempjumlah3-$tempjumlah4, 0, ",", ".")."".number_format($temphp3-$temphp4, 0, ",", ".")."
~".$str[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")."".number_format($jmlren[$i]['wanita']-$jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita']-$rprev[$i]['wanita'], 0, ",", ".")."
".number_format($tempjumlah3, 0, ",", ".")."".number_format($temphp3, 0, ",", ".")."".number_format($tempjumlah4, 0, ",", ".")."".number_format($temphp4, 0, ",", ".")."".number_format($tempjumlah3-$tempjumlah4, 0, ",", ".")."".number_format($temphp3-$temphp4, 0, ",", ".")."
TOTAL WANITA".number_format($ttJmlBeli['wanita']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['hp'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['hpRev'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['jml']-$ttJmlBeli['wanita']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['hp']-$ttJmlBeli['wanita']['hpRev'], 0, ",", ".")."
Anak
~".$str[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")."".number_format($jmlren[$i]['anak']-$jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak']-$rprev[$i]['anak'], 0, ",", ".")."
".number_format($tempjumlah5, 0, ",", ".")."".number_format($temphp5, 0, ",", ".")."".number_format($tempjumlah6, 0, ",", ".")."".number_format($temphp6, 0, ",", ".")."".number_format($tempjumlah5-$tempjumlah6, 0, ",", ".")."".number_format($temphp5-$temphp6, 0, ",", ".")."
~".$str[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")."".number_format($jmlren[$i]['anak']-$jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak']-$rprev[$i]['anak'], 0, ",", ".")."
".number_format($tempjumlah5, 0, ",", ".")."".number_format($temphp5, 0, ",", ".")."".number_format($tempjumlah6, 0, ",", ".")."".number_format($temphp6, 0, ",", ".")."".number_format($tempjumlah5-$tempjumlah6, 0, ",", ".")."".number_format($temphp5-$temphp6, 0, ",", ".")."
TOTAL ANAK".number_format($ttJmlBeli['anak']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['hp'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['hpRev'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['jml']-$ttJmlBeli['anak']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['hp']-$ttJmlBeli['anak']['hpRev'], 0, ",", ".")."
Sepatu
~".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlren[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu'], 0, ",", ".")."".number_format($jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rprev[$i]['sepatu'], 0, ",", ".")."".number_format($jmlren[$i]['sepatu']-$jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu']-$rprev[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlah7, 0, ",", ".")."".number_format($temphp7, 0, ",", ".")."".number_format($tempjumlah8, 0, ",", ".")."".number_format($temphp8, 0, ",", ".")."".number_format($tempjumlah7-$tempjumlah8, 0, ",", ".")."".number_format($temphp7-$temphp8, 0, ",", ".")."
~".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlren[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu'], 0, ",", ".")."".number_format($jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rprev[$i]['sepatu'], 0, ",", ".")."".number_format($jmlren[$i]['sepatu']-$jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu']-$rprev[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlah7, 0, ",", ".")."".number_format($temphp7, 0, ",", ".")."".number_format($tempjumlah8, 0, ",", ".")."".number_format($temphp8, 0, ",", ".")."".number_format($tempjumlah7-$tempjumlah8, 0, ",", ".")."".number_format($temphp7-$temphp8, 0, ",", ".")."
TOTAL SEPATU".number_format($ttJmlBeli['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hpRev'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['jml']-$ttJmlBeli['sepatu']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp']-$ttJmlBeli['sepatu']['hpRev'], 0, ",", ".")."
T O T A L : ".number_format($ttjml1, 0, ",", ".")."".number_format($ttrp1, 0, ",", ".")."".number_format($ttjml2, 0, ",", ".")."".number_format($ttrp2, 0, ",", ".")."".number_format($ttjml1-$ttjml2, 0, ",", ".")."".number_format($ttrp1-$ttrp2, 0, ",", ".")."

"); + }else{ + echo "Tidak ada data untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/laprekapretbeli.php b/old-source/LaporanBeli/laprekapretbeli.php new file mode 100644 index 0000000..b600623 --- /dev/null +++ b/old-source/LaporanBeli/laprekapretbeli.php @@ -0,0 +1,71 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + + if(bukaKoneksi()){ + global $conn; + $query = "select r.`tgl_retur`, r.`no_nota`, r.`kd_supplier`,s.nama_supplier, d.jum, d.tot, k.nama, r.`keterangan` + from m_retur_beli r,supplier s,karyawan k, + (select id_retur,sum(jumlah) jum,sum(jumlah*harga_satuan) tot from d_retur_beli group by id_retur) d + where tgl_retur between '$startDate' and '$endDate' + and r.kd_supplier = s.kd_supplier + and r.id_retur = d.id_retur + and r.nik = k.nik + and r.validasi = '1'"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tgl,$nota,$kdsup,$nama,$jum,$tot,$kary,$als); + $ttJumlah = array(); + $ttJumlah['jml'] = 0; + $ttJumlah['rp'] = 0; + + print("
"); + print("

Laporan Rekap Retur Pembelian



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['jml'] += $jum; + $ttJumlah['rp'] += $tot; + print(""); + } + + print("
TanggalNo.NotaKode Supp.Nama Supp.Jumlah Brg.TotalAsskoAlasan
".encTgl($tgl).".$nota.$kdsup$nama$jum".number_format($tot,0,',','.')."$kary$als

"); + print("
"); + + print(""); + print(""); + + print("
Total Jumlah Retur : ".number_format($ttJumlah['jml'],0,',','.')."
Total Rp Retur : ".number_format($ttJumlah['rp'],0,',','.')."
"); + }else{ + echo "Tidak ada data retur untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/laprekapretbeli.php~ b/old-source/LaporanBeli/laprekapretbeli.php~ new file mode 100644 index 0000000..e1c9603 --- /dev/null +++ b/old-source/LaporanBeli/laprekapretbeli.php~ @@ -0,0 +1,72 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + + if(bukaKoneksi()){ + global $conn; + $query = "select r.`tgl_retur`, r.`no_nota`, r.`kd_supplier`,s.nama_supplier, d.jum, d.tot, k.nama, r.`keterangan` + from m_retur_beli r,supplier s,karyawan k, + (select id_retur,sum(jumlah) jum,sum(jumlah*harga_satuan) tot from d_retur_beli group by id_retur) d + where tgl_retur between '$startDate' and '$endDate' + and r.kd_supplier = s.kd_supplier + and r.id_retur = d.id_retur + and r.nik = k.nik + and r.validasi = '1'"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tgl,$nota,$kdsup,$nama,$jum,$tot,$kary,$als); + $ttJumlah = array(); + $ttJumlah['jml'] = 0; + $ttJumlah['rp'] = 0; + + print("
"); + print("

Laporan Rekap Retur Pembelian



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['jml'] += $jum; + $ttJumlah['rp'] += $tot; + print(""); + } + + print("
TanggalNo.NotaKode Supp.Nama Supp.Jumlah Brg.TotalAsskoAlasan
".encTgl($tgl).".$nota.$kdsup$nama$jum".number_format($tot,0,',','.')."$kary$als

"); + print("
"); + + print(""); + print(""); + + print("
Total Jumlah Retur : ".number_format($ttJumlah['jml'],0,',','.')."
Total Rp Retur : ".number_format($ttJumlah['rp'],0,',','.')."
"); + }else{ + echo "Tidak ada data retur untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/lapreturperasko.php~ b/old-source/LaporanBeli/lapreturperasko.php~ new file mode 100644 index 0000000..63d4f6e --- /dev/null +++ b/old-source/LaporanBeli/lapreturperasko.php~ @@ -0,0 +1,92 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + + if(bukaKoneksi()){ + global $conn; + $query = "select r.tgl_retur,m.tgl_nota,r.no_nota,r.kd_supplier,s.nama_supplier,sum(d.jumlah),r.total_retur,r.nik,k.nama + from m_retur_beli r, d_retur_beli d, m_pembelian m, supplier s,karyawan k + where r.validasi = 1 + and r.id_retur = d.id_retur + and r.no_nota = m.no_faktur + and r.kd_supplier = s.kd_supplier + and r.nik = k.nik + and date(r.tgl_retur) between '$startDate' and '$endDate' + group by r.id_retur"; + $query2 ="select A.nik,A.nama,count(*) + from + (select r.tgl_retur,r.no_nota,r.kd_supplier,r.total_retur,r.nik,k.nama + from + m_retur_beli r, d_retur_beli d,karyawan k + where r.validasi = 1 + and r.id_retur = d.id_retur + and r.nik = k.nik + and date(r.tgl_retur) between '$startDate' and '$endDate' + group by r.id_retur) A + group by A.nik"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tglret,$tglnota,$nota,$kdsup,$nama,$jum,$tot,$nik,$kary); + $ttJumlah = array(); + $ttJumlah['jml'] = 0; + $ttJumlah['rp'] = 0; + + print("
"); + print("

Laporan Rekap Retur Per Assko



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['jml'] += $jum; + $ttJumlah['rp'] += $tot; + print(""); + } + + print("
Tgl ReturTgl NotaNo.NotaKode Supp.Nama Supp.Jumlah Brg.TotalAssko
".encTgl($tglret)."".encTgl($tglnota).".$nota.$kdsup$nama$jum".number_format($tot,0,',','.')."$kary

"); + print("
"); + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$nik,$kary,$count); + while(mysqli_stmt_fetch($stmt2)){ + print(""); + } + } + } + print("
$nik$kary : $countkali.
"); + }else{ + echo "Tidak ada data retur untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/laprncordersupp.php~ b/old-source/LaporanBeli/laprncordersupp.php~ new file mode 100644 index 0000000..cfe4cb0 --- /dev/null +++ b/old-source/LaporanBeli/laprncordersupp.php~ @@ -0,0 +1,95 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = $_POST['startDate']; + $endDate = $_POST['endDate']; + $bulan = $_POST['bulan']; + $tahun = substr($_POST['tahun'],2,2); + + if(bukaKoneksi()){ + global $conn; + if ($startDate != '' and $endDate != '' and $bulan != '' and $tahun != ''){ + $query = "select m.kode_strip, d.vol_revisi,d.artikel_revisi,d.nomor_revisi + from m_rencana_beli m inner join d_rencana_beli d on (m.id=d.id) + where m.status_revisi = '1' + and d.kode_supplier = '$startDate' + and m.kode_strip = '$endDate' + and m.bulanR = '$bulan' + and m.tahunR = '$tahun'"; + }else{ + $query = "select m.kode_strip, d.vol_revisi,d.artikel_revisi,d.nomor_revisi + from m_rencana_beli m inner join d_rencana_beli d on (m.id=d.id) + where m.status_revisi = '1' + and d.kode_supplier = '$startDate' + and m.bulanR = '$bulan' + and m.tahunR = '$tahun'"; + } + $query2 = "select s.nama_supplier + from supplier s + where s.kd_supplier = '$startDate'"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdstrip,$vol,$artikel,$nomor); + $ttJumlah = array(); + $ttJumlah['jml'] = 0; + + print("
"); + print("

Rekap Rencana Order Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')."

"); + print("Bulan : ".$bulan."
"); + print("Tahun : ".$_POST['tahun']."
"); + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$namasupp); + while(mysqli_stmt_fetch($stmt2)){ + print("Kode Supplier : ".$startDate."
"); + print("Nama Supplier : ".$namasupp."


"); + + } + } + } + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['jml'] += $vol; + print(""); + } + + print("
Lini ProdukJuml BarangArtikelNomor Brg
$kdstrip$vol$artikel$nomor

"); + print("
"); + + print(""); + print("
Total Jumlah Beli : ".number_format($ttJumlah['jml'],0,',','.')."
"); + }else{ + echo "Tidak ada data rencana order untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/laprncpersupp.php~ b/old-source/LaporanBeli/laprncpersupp.php~ new file mode 100644 index 0000000..5681e6d --- /dev/null +++ b/old-source/LaporanBeli/laprncpersupp.php~ @@ -0,0 +1,312 @@ +"; + echo "div#divprint{width:900px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:850px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = $_POST['startDate']; //kd supp + $endDate = $_POST['endDate']; // lini + $bln = $_POST['bulan']; + $thn = substr($_POST['tahun'],2,2); + + if(bukaKoneksi()){ + global $conn; + + if ($startDate != '' and $endDate != '' and $bulan != '' and $tahun != ''){ + $query = "SELECT st.kel_jns, m.kode_strip, d.kode_supplier, s.nama_supplier, sum(d.vol_rencana), sum(d.rupiah_rencana), m.status_rencana, + sum(d.vol_revisi), sum(d.rupiah_revisi), m.status_revisi + FROM d_rencana_beli d, m_rencana_beli m, supplier s, strip st + WHERE m.tahunR = '$thn' and m.bulanR = '$bln' + and m.id=d.id + and d.kode_supplier = s.kd_supplier + and m.kode_strip = st.kd_strip + and d.kode_supplier = '$startDate' + and m.kode_strip = '$endDate' + GROUP BY d.kode_supplier, m.kode_strip + ORDER BY m.kode_strip"; + }else if ($startDate != '' and $bulan != '' and $tahun != ''){ + $query = "SELECT st.kel_jns, m.kode_strip, d.kode_supplier, s.nama_supplier, sum(d.vol_rencana), sum(d.rupiah_rencana), m.status_rencana, + sum(d.vol_revisi), sum(d.rupiah_revisi), m.status_revisi + FROM d_rencana_beli d, m_rencana_beli m, supplier s, strip st + WHERE m.tahunR = '$thn' and m.bulanR = '$bln' + and m.id=d.id + and d.kode_supplier = s.kd_supplier + and m.kode_strip = st.kd_strip + and d.kode_supplier = '$startDate' + GROUP BY d.kode_supplier, m.kode_strip + ORDER BY m.kode_strip"; + }else if ($endDate != '' and $bulan != '' and $tahun != ''){ + $query = "SELECT st.kel_jns, m.kode_strip, d.kode_supplier, s.nama_supplier, sum(d.vol_rencana), sum(d.rupiah_rencana), m.status_rencana, + sum(d.vol_revisi), sum(d.rupiah_revisi), m.status_revisi + FROM d_rencana_beli d, m_rencana_beli m, supplier s, strip st + WHERE m.tahunR = '$thn' and m.bulanR = '$bln' + and m.id=d.id + and d.kode_supplier = s.kd_supplier + and m.kode_strip = st.kd_strip + and m.kode_strip = '$endDate' + GROUP BY d.kode_supplier, m.kode_strip + ORDER BY m.kode_strip"; + }else{ + $query = "SELECT st.kel_jns, m.kode_strip, d.kode_supplier, s.nama_supplier, sum(d.vol_rencana), sum(d.rupiah_rencana), m.status_rencana, + sum(d.vol_revisi), sum(d.rupiah_revisi), m.status_revisi + FROM d_rencana_beli d, m_rencana_beli m, supplier s, strip st + WHERE m.tahunR = '$thn' and m.bulanR = '$bln' + and m.id=d.id + and d.kode_supplier=s.kd_supplier + and m.kode_strip = st.kd_strip + GROUP BY d.kode_supplier, m.kode_strip + ORDER BY m.kode_strip"; + } + + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek >= 0){ + mysqli_stmt_bind_result($stmt,$kelJns,$strip,$kd,$nm,$vrenc,$hprenc,$statrenc,$vrev,$hprev,$statrev); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['pria']['jmlRev'] = 0; + $ttJmlBeli['pria']['hpRev'] = 0; + + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['wanita']['jmlRev'] = 0; + $ttJmlBeli['wanita']['hpRev'] = 0; + + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['anak']['jmlRev'] = 0; + $ttJmlBeli['anak']['hpRev'] = 0; + + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + $ttJmlBeli['sepatu']['jmlRev'] = 0; + $ttJmlBeli['sepatu']['hpRev'] = 0; + + print("
"); + print("

Laporan Rencana Belanja Per Supllier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."

"); + print("Bulan Rencana : ".$bln."
"); + print("Tahun Rencana : ".$_POST['tahun']."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $str = array(); + $jmlren = array(); + $rpren = array(); + $stsren = array(); + $jmlrev = array(); + $rprev = array(); + $stsrev = array(); + + while(mysqli_stmt_fetch($stmt)){ + if($kelJns == "P"){ + $kelJns = "Pria"; + $ttJmlBeli['pria']['jml'] += $vrenc; + $ttJmlBeli['pria']['hp'] += $hprenc; + $ttJmlBeli['pria']['jmlRev'] += $vrev; + $ttJmlBeli['pria']['hpRev'] += $hprev; + $str[$pria]['pria'] = $strip; + $jmlren[$pria]['pria'] = $vrenc; + $rpren[$pria]['pria'] = $hprenc; + $stsren[$pria]['pria'] = $statrenc; + $jmlrev[$pria]['pria'] = $vrev; + $rprev[$pria]['pria'] = $hprev; + $stsrev[$pria]['pria'] = $statrev; + $kdSupp[$pria]['pria'] = $kd; + $nmSupp[$pria]['pria'] = $nm; + $pria++; + }elseif($kelJns == "W"){ + $kelJns = "Wanita"; + $ttJmlBeli['wanita']['jml'] += $vrenc; + $ttJmlBeli['wanita']['hp'] += $hprenc; + $ttJmlBeli['wanita']['jmlRev'] += $vrev; + $ttJmlBeli['wanita']['hpRev'] += $hprev; + $str[$wanita]['wanita'] = $strip; + $jmlren[$wanita]['wanita'] = $vrenc; + $rpren[$wanita]['wanita'] = $hprenc; + $stsren[$wanita]['wanita'] = $statrenc; + $jmlrev[$wanita]['wanita'] = $vrev; + $rprev[$wanita]['wanita'] = $hprev; + $stsrev[$wanita]['wanita'] = $statrev; + $kdSupp[$wanita]['wanita'] = $kd; + $nmSupp[$wanita]['wanita'] = $nm; + $wanita++; + }elseif($kelJns == "A"){ + $kelJns = "Anak"; + $ttJmlBeli['anak']['jml'] += $vrenc; + $ttJmlBeli['anak']['hp'] += $hprenc; + $ttJmlBeli['anak']['jmlRev'] += $vrev; + $ttJmlBeli['anak']['hpRev'] += $hprev; + $str[$anak]['anak'] = $strip; + $jmlren[$anak]['anak'] = $vrenc; + $rpren[$anak]['anak'] = $hprenc; + $stsren[$anak]['anak'] = $statrenc; + $jmlrev[$anak]['anak'] = $vrev; + $rprev[$anak]['anak'] = $hprev; + $stsrev[$anak]['anak'] = $statrev; + $kdSupp[$anak]['anak'] = $kd; + $nmSupp[$anak]['anak'] = $nm; + $anak++; + }else{ + $kelJns = "Sepatu"; + $ttJmlBeli['sepatu']['jml'] += $vrenc; + $ttJmlBeli['sepatu']['hp'] += $hprenc; + $ttJmlBeli['sepatu']['jmlRev'] += $vrev; + $ttJmlBeli['sepatu']['hpRev'] += $hprev; + $str[$sepatu]['sepatu'] = $strip; + $jmlren[$sepatu]['sepatu'] = $vrenc; + $rpren[$sepatu]['sepatu'] = $hprenc; + $stsren[$sepatu]['sepatu'] = $statrenc; + $jmlrev[$sepatu]['sepatu'] = $vrev; + $rprev[$sepatu]['sepatu'] = $hprev; + $stsrev[$sepatu]['sepatu'] = $statrev; + $kdSupp[$sepatu]['sepatu'] = $kd; + $nmSupp[$sepatu]['sepatu'] = $nm; + $sepatu++; + } + + } + print(""); + print(""); + print("
"); + +/* PRIA -------------------------------------------------------------------------*/ + if($ttJmlBeli['pria']['jml']!=0){ + print("
"); + for($i=0;$i<$pria;$i++){ + if ($str[$i-1]['pria']==$str[$i]['pria']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlah1 = 0; + $temphp1 = 0; + $tempjumlah2 = 0; + $temphp2 = 0; + } + $tempjumlah1 += $jmlren[$i]['pria']; + $temphp1 += $rpren[$i]['pria']; + $tempjumlah2 += $jmlrev[$i]['pria']; + $temphp2 += $rprev[$i]['pria']; + + } + print(""); + } + + print(""); + +/* WANITA -------------------------------------------------------------------------*/ + if($ttJmlBeli['wanita']['jml']!=0){ + print(""); + for($i=0;$i<$wanita;$i++){ + if ($str[$i-1]['wanita']==$str[$i]['wanita']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlah3 = 0; + $temphp3 = 0; + $tempjumlah4 = 0; + $temphp4 = 0; + } + $tempjumlah3 += $jmlren[$i]['wanita']; + $temphp3 += $rpren[$i]['wanita']; + $tempjumlah4 += $jmlrev[$i]['wanita']; + $temphp4 += $rprev[$i]['wanita']; + + } + print(""); + } + + print(""); +/* ANAK -------------------------------------------------------------------------*/ + if($ttJmlBeli['anak']['jml']!=0){ + print(""); + for($i=0;$i<$anak;$i++){ + if ($str[$i-1]['anak']==$str[$i]['anak']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlah5 = 0; + $temphp5 = 0; + $tempjumlah6 = 0; + $temphp6 = 0; + } + $tempjumlah5 += $jmlren[$i]['anak']; + $temphp5 += $rpren[$i]['anak']; + $tempjumlah6 += $jmlrev[$i]['anak']; + $temphp6 += $rprev[$i]['anak']; + + } + print(""); + } + + print(""); +/* SEPATU -------------------------------------------------------------------------*/ + if($ttJmlBeli['sepatu']['jml']!=0){ + print(""); + for($i=0;$i<$sepatu;$i++){ + if ($str[$i-1]['sepatu']==$str[$i]['sepatu']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlah7 = 0; + $temphp7 = 0; + $tempjumlah8 = 0; + $temphp8 = 0; + } + $tempjumlah7 += $jmlren[$i]['sepatu']; + $temphp7 += $rpren[$i]['sepatu']; + $tempjumlah8 += $jmlrev[$i]['sepatu']; + $temphp8 += $rprev[$i]['sepatu']; + + } + print(""); + } + + print(""); + + $ttjml1 = $ttJmlBeli['pria']['jml'] + $ttJmlBeli['wanita']['jml'] + $ttJmlBeli['anak']['jml'] + $ttJmlBeli['sepatu']['jml']; + $ttrp1 = $ttJmlBeli['pria']['hp'] + $ttJmlBeli['wanita']['hp'] + $ttJmlBeli['anak']['hp'] + $ttJmlBeli['sepatu']['hp']; + $ttjml2 = $ttJmlBeli['pria']['jmlRev'] + $ttJmlBeli['wanita']['jmlRev'] + $ttJmlBeli['anak']['jmlRev'] + $ttJmlBeli['sepatu']['jmlRev']; + $ttrp2 = $ttJmlBeli['pria']['hpRev'] + $ttJmlBeli['wanita']['hpRev'] + $ttJmlBeli['anak']['hpRev'] + $ttJmlBeli['sepatu']['hpRev']; + + print(" + + + + "); + + print("
KategoriLini ProdukKode SupplierNama SupplierJumlah RencTotal HP RencValid RencJumlah Rev.Total HP Rev.Valid Rev.
Pria
~".$str[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")."".$stsren[$i]['pria']."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")."".$stsrev[$i]['pria']."
".number_format($tempjumlah1, 0, ",", ".")."".number_format($temphp1, 0, ",", ".")."".number_format($tempjumlah2, 0, ",", ".")."".number_format($temphp2, 0, ",", ".")."
~".$str[$i]['pria'].".".$kdSupp[$i]['pria']."".$nmSupp[$i]['pria']."".number_format($jmlren[$i]['pria'], 0, ",", ".")."".number_format($rpren[$i]['pria'], 0, ",", ".")."".$stsren[$i]['pria']."".number_format($jmlrev[$i]['pria'], 0, ",", ".")."".number_format($rprev[$i]['pria'], 0, ",", ".")."".$stsrev[$i]['pria']."
".number_format($tempjumlah1, 0, ",", ".")."".number_format($temphp1, 0, ",", ".")."".number_format($tempjumlah2, 0, ",", ".")."".number_format($temphp2, 0, ",", ".")."
TOTAL PRIA".number_format($ttJmlBeli['pria']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['hp'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['pria']['hpRev'], 0, ",", ".")."
Wanita
~".$str[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")."".$stsren[$i]['wanita']."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")."".$stsrev[$i]['wanita']."
".number_format($tempjumlah3, 0, ",", ".")."".number_format($temphp3, 0, ",", ".")."".number_format($tempjumlah4, 0, ",", ".")."".number_format($temphp4, 0, ",", ".")."
~".$str[$i]['wanita'].".".$kdSupp[$i]['wanita']."".$nmSupp[$i]['wanita']."".number_format($jmlren[$i]['wanita'], 0, ",", ".")."".number_format($rpren[$i]['wanita'], 0, ",", ".")."".$stsren[$i]['wanita']."".number_format($jmlrev[$i]['wanita'], 0, ",", ".")."".number_format($rprev[$i]['wanita'], 0, ",", ".")."".$stsrev[$i]['wanita']."
".number_format($tempjumlah3, 0, ",", ".")."".number_format($temphp3, 0, ",", ".")."".number_format($tempjumlah4, 0, ",", ".")."".number_format($temphp4, 0, ",", ".")."
TOTAL WANITA".number_format($ttJmlBeli['wanita']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['hp'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['wanita']['hpRev'], 0, ",", ".")."
Anak
~".$str[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")."".$stsren[$i]['anak']."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")."".$stsrev[$i]['anak']."
".number_format($tempjumlah5, 0, ",", ".")."".number_format($temphp5, 0, ",", ".")."".number_format($tempjumlah6, 0, ",", ".")."".number_format($temphp6, 0, ",", ".")."
~".$str[$i]['anak'].".".$kdSupp[$i]['anak']."".$nmSupp[$i]['anak']."".number_format($jmlren[$i]['anak'], 0, ",", ".")."".number_format($rpren[$i]['anak'], 0, ",", ".")."".$stsren[$i]['anak']."".number_format($jmlrev[$i]['anak'], 0, ",", ".")."".number_format($rprev[$i]['anak'], 0, ",", ".")."".$stsrev[$i]['anak']."
".number_format($tempjumlah5, 0, ",", ".")."".number_format($temphp5, 0, ",", ".")."".number_format($tempjumlah6, 0, ",", ".")."".number_format($temphp6, 0, ",", ".")."
TOTAL ANAK".number_format($ttJmlBeli['anak']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['hp'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['anak']['hpRev'], 0, ",", ".")."
Sepatu
~".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlren[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu'], 0, ",", ".")."".$stsren[$i]['sepatu']."".number_format($jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rprev[$i]['sepatu'], 0, ",", ".")."".$stsrev[$i]['sepatu']."
".number_format($tempjumlah7, 0, ",", ".")."".number_format($temphp7, 0, ",", ".")."".number_format($tempjumlah8, 0, ",", ".")."".number_format($temphp8, 0, ",", ".")."
~".$str[$i]['sepatu'].".".$kdSupp[$i]['sepatu']."".$nmSupp[$i]['sepatu']."".number_format($jmlren[$i]['sepatu'], 0, ",", ".")."".number_format($rpren[$i]['sepatu'], 0, ",", ".")."".$stsren[$i]['sepatu']."".number_format($jmlrev[$i]['sepatu'], 0, ",", ".")."".number_format($rprev[$i]['sepatu'], 0, ",", ".")."".$stsrev[$i]['sepatu']."
".number_format($tempjumlah7, 0, ",", ".")."".number_format($temphp7, 0, ",", ".")."".number_format($tempjumlah8, 0, ",", ".")."".number_format($temphp8, 0, ",", ".")."
TOTAL SEPATU".number_format($ttJmlBeli['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['jmlRev'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hpRev'], 0, ",", ".")."
T O T A L : ".number_format($ttjml1, 0, ",", ".")."".number_format($ttrp1, 0, ",", ".")."".number_format($ttjml2, 0, ",", ".")."".number_format($ttrp2, 0, ",", ".")."

"); + }else{ + echo "Tidak ada data order untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/lapsuppjtempo.php b/old-source/LaporanBeli/lapsuppjtempo.php new file mode 100644 index 0000000..3682e33 --- /dev/null +++ b/old-source/LaporanBeli/lapsuppjtempo.php @@ -0,0 +1,91 @@ +"; + echo "div#divprint{width:1024px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:950px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:50px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDateJtempo = decTgl($_POST['startDate3']); + $endDateJtempo = decTgl($_POST['endDate3']); + $startDateNota = decTgl($_POST['startDate4']); + $endDateNota = decTgl($_POST['endDate4']); + + if(bukaKoneksi()){ + global $conn; + if(strlen($startDateNota) <= 2 && strlen($endDateNota) <= 2){ + $query = "SELECT m.no_faktur, m.tgl_masuk, m.tgl_nota, m.tgl_jatuh_tempo, m.kd_supplier, s.nama_supplier, m.total_beli, m.rp_beli, m.keterangan, k.nama + FROM m_pembelian m, supplier s, karyawan k + WHERE s.kd_supplier = m.kd_supplier + AND m.tgl_jatuh_tempo BETWEEN '$startDateJtempo' AND '$endDateJtempo' + AND m.validasi = '1' + AND m.status_revisi = '1' + AND m.nik = k.nik + ORDER BY m.tgl_jatuh_tempo,m.tgl_nota,m.kd_supplier"; + }elseif(strlen($startDateNota) > 2 && strlen($endDateNota) > 2 ){ + $query = "SELECT m.no_faktur, m.tgl_masuk, m.tgl_nota, m.tgl_jatuh_tempo, m.kd_supplier, s.nama_supplier, m.total_beli, m.rp_beli, m.keterangan, k.nama + FROM m_pembelian m, supplier s, karyawan k + WHERE s.kd_supplier = m.kd_supplier + AND m.tgl_jatuh_tempo BETWEEN '$startDateJtempo' AND '$endDateJtempo' + AND m.tgl_nota BETWEEN '$startDateNota' AND '$endDateNota' + AND m.validasi = '1' + AND m.status_revisi = '1' + AND m.nik = k.nik + ORDER BY m.tgl_jatuh_tempo,m.tgl_nota,m.kd_supplier"; + + } + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$faktur,$tglMsk,$tglNota,$tglTmp,$kdSup,$nmSup,$ttBeli,$ttRp,$ket,$name); + $ttJumlah = array(); + $ttJumlah['faktur'] = 0; + $ttJumlah['jml'] = 0; + $ttJumlah['rp'] = 0; + + + print("
"); + print("

Laporan Pembelian Per Supplier Berdasarkan Tanggal Jatuh Tempo



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("Periode Jatuh Tempo : ".encTgl($startDateJtempo) ." s/d ".encTgl($endDateJtempo)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['faktur']++; + $ttJumlah['jml'] += $ttBeli; + $ttJumlah['rp'] += $ttRp; + + print(""); + } + + print("
No. FakturTanggal MasukTanggal NotaTanggal Jt TempoKode Supp.Nama SupplierJumlah PembelianTotal PembelianKeteranganNama Assko
.$faktur".encTgl($tglMsk)."".encTgl($tglNota)."".encTgl($tglTmp).".$kdSup$nmSup".number_format($ttBeli,0,',','.')."".number_format($ttRp,0,',','.')."$ket$name

"); + print("
"); + print(""); + print(""); + print(""); + + print("
Total Lembar Nota : ".number_format($ttJumlah['faktur'],0,',','.')."
Total Jumlah Beli : ".number_format($ttJumlah['jml'],0,',','.')."
Total Pembelian : ".number_format($ttJumlah['rp'],0,',','.')."
"); + }else{ + echo "Belum ada data pembelian untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanBeli/menu.php b/old-source/LaporanBeli/menu.php new file mode 100644 index 0000000..1f41549 --- /dev/null +++ b/old-source/LaporanBeli/menu.php @@ -0,0 +1,129 @@ + + + + + +
+ +
diff --git a/old-source/LaporanBeli/orderblmdtg.php~ b/old-source/LaporanBeli/orderblmdtg.php~ new file mode 100644 index 0000000..4b3e9c3 --- /dev/null +++ b/old-source/LaporanBeli/orderblmdtg.php~ @@ -0,0 +1,96 @@ + + + + + Amigo Group :: Pengadaan Barang + + + + + + + + + + + + + + + + + +
+
+ +
+
+
Rekap Order Belum Datang
+
+
+
+ + +
Kode Supplier: +
Lini Produk : +
Bulan : [01,02,dst]* +
Tahun : * +
+
+ tanda (*) = kolom harus diisi +
+
+
+
+ +
+
Cari Supplier
+
+ +
+
+ + + + +
Nama: +
+
+
+ Hasil pencarian +
+
+
+
+ + + + + + diff --git a/old-source/LaporanBeli/rekapretbeli.php b/old-source/LaporanBeli/rekapretbeli.php new file mode 100644 index 0000000..754b972 --- /dev/null +++ b/old-source/LaporanBeli/rekapretbeli.php @@ -0,0 +1,82 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Rekap Retur Pembelian +
+
+
+ + + +
Range Tanggal: s/d
+
+
+
+
+ +
+ + diff --git a/old-source/LaporanBeli/rnc_and_order.php~ b/old-source/LaporanBeli/rnc_and_order.php~ new file mode 100644 index 0000000..84ce1e1 --- /dev/null +++ b/old-source/LaporanBeli/rnc_and_order.php~ @@ -0,0 +1,96 @@ + + + + + Amigo Group :: Pengadaan Barang + + + + + + + + + + + + + + + + + +
+
+ +
+
+
Rekap Rencana & Realisasi Order
+
+
+
+ + +
Kode Supplier: +
Lini Produk : +
Bulan : [01,02,dst]* +
Tahun : * +
+
+ tanda (*) = kolom harus diisi +
+
+
+
+ +
+
Cari Supplier
+
+ +
+
+ + + + +
Nama: +
+
+
+ Hasil pencarian +
+
+
+
+ + + + + + diff --git a/old-source/LaporanBeli/rnc_order_brgdtg.php~ b/old-source/LaporanBeli/rnc_order_brgdtg.php~ new file mode 100644 index 0000000..4026812 --- /dev/null +++ b/old-source/LaporanBeli/rnc_order_brgdtg.php~ @@ -0,0 +1,96 @@ + + + + + Amigo Group :: Pengadaan Barang + + + + + + + + + + + + + + + + + +
+
+ +
+
+
Rekap Rencana,Realisasi Order & Barang Datang
+
+
+
+ + +
Kode Supplier: +
Lini Produk : +
Bulan : [01,02,dst]* +
Tahun : * +
+
+ tanda (*) = kolom harus diisi +
+
+
+
+ +
+
Cari Supplier
+
+ +
+
+ + + + +
Nama: +
+
+
+ Hasil pencarian +
+
+
+
+ + + + + + diff --git a/old-source/LaporanBeli/rncordersupp.php~ b/old-source/LaporanBeli/rncordersupp.php~ new file mode 100644 index 0000000..4e5cb9b --- /dev/null +++ b/old-source/LaporanBeli/rncordersupp.php~ @@ -0,0 +1,95 @@ + + + + + Amigo Group :: Pengadaan Barang + + + + + + + + + + + + + + + + + +
+
+ +
+
+
Rekap Rencana Order Per Supplier
+
+
+
+ + +
Kode Supplier: * +
Lini Produk : +
Bulan : [01,02,dst]* +
Tahun : * +
+
+
+
+
+
+ +
+
Cari Supplier
+
+ +
+
+ + + + +
Nama: +
+
+
+ Hasil pencarian +
+
+
+
+ + + + + + diff --git a/old-source/LaporanBeli/rncpersupp.php~ b/old-source/LaporanBeli/rncpersupp.php~ new file mode 100644 index 0000000..2e3005a --- /dev/null +++ b/old-source/LaporanBeli/rncpersupp.php~ @@ -0,0 +1,96 @@ + + + + + Amigo Group :: Pengadaan Barang + + + + + + + + + + + + + + + + + +
+
+ +
+
+
Rekap Rencana Per Supplier
+
+
+
+ + + tanda (*) = kolom harus diisi +
Kode Supplier: +
Lini Produk : +
Bulan : [01,02,dst]* +
Tahun : * +
+
+
+
+
+
+ +
+
Cari Supplier
+
+ +
+
+ + + + +
Nama: +
+
+
+ Hasil pencarian +
+
+
+
+ + + + + + diff --git a/old-source/LaporanJual/ajaxpelanggan.php b/old-source/LaporanJual/ajaxpelanggan.php new file mode 100644 index 0000000..4e8eced --- /dev/null +++ b/old-source/LaporanJual/ajaxpelanggan.php @@ -0,0 +1,173 @@ + +prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + + +function cek_pelanggan($id_pelanggan) +{ + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT COUNT(*) FROM pelanggan WHERE kd_customer = '{$id_pelanggan}'")->fetch_array(); + if ($data[0] > 0) + { + return true; + } else + { + return false; + } +} + +function cari_pelanggan($nama) { + if($nama != "") { + $harray = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT kd_customer, nama, alamat, nilai_bon, bts_bon FROM pelanggan WHERE nama LIKE '%".$nama."%'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_customer' => $a['kd_customer'], + 'nama' => $a['nama'], + 'alamat' => $a['alamat'], + 'nilai_bon' => number_format($a['nilai_bon'],0,',','.'), + 'bts_bon' => number_format($a['bts_bon'],0,',','.') + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function cari_upline($nama) { + if($nama != "") { + $harray = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT kd_customer, nama, alamat, nilai_bon, bts_bon FROM pelanggan WHERE nama LIKE '%".$nama."%' AND upline = '#'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_customer' => $a['kd_customer'], + 'nama' => $a['nama'], + 'alamat' => $a['alamat'], + 'nilai_bon' => number_format($a['nilai_bon'],0,',','.'), + 'bts_bon' => number_format($a['bts_bon'],0,',','.') + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function ambil_pelanggan($id_pelanggan) { + if ($id_pelanggan != "") { + $array_data = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM pelanggan WHERE kd_customer = '".$id_pelanggan."'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $tgl_lahir = ''; + + if($a['tgl_lahir'] != "") { + $tgl_lahir = substr($a['tgl_lahir'],8,2)."-".substr($a['tgl_lahir'],5,2)."-".substr($a['tgl_lahir'],0,4); + } else { + $tgl_lahir = $a['tgl_lahir']; + } + + $array_data[$idx] = array( + 'kd_customer' => $a['kd_customer'], + 'alias' => $a['alias'], + 'member' => $a['member'], + 'ktp' => $a['ktp'], + 'nama' => $a['nama'], + 'alamat' => $a['alamat'], + 'kd_lokasi' => $a['kd_lokasi'], + 'wilayah' => $a['wilayah'], + 'tempat_lahir' => $a['tempat_lahir'], + 'tgl_lahir' => $tgl_lahir, + 'jns_kelamin' => $a['jns_kelamin'], + 'agama' => $a['agama'], + 'kd_lokasi' => $a['kd_lokasi'], + 'pekerjaan' => $a['pekerjaan'], + 'status_nikah' => $a['status_nikah'], + 'telp' => $a['telp'], + 'ponsel' => $a['ponsel'], + 'email' => $a['email'], + 'status' => $a['status'], + 'upline' => $a['upline'], + 'bts_bon' => $a['bts_bon'], + 'nilai_bon' => $a['nilai_bon'], + 'bts_bon_istimewa' => $a['bts_bon_istimewa'], + 'nilai_komisi' => $a['nilai_komisi'], + 'komisi_diambil' => $a['komisi_diambil'], + 'jenis_customer' => $a['jenis_customer'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($array_data); + } +} + +?> \ No newline at end of file diff --git a/old-source/LaporanJual/ajaxsupplier.php b/old-source/LaporanJual/ajaxsupplier.php new file mode 100644 index 0000000..6393c13 --- /dev/null +++ b/old-source/LaporanJual/ajaxsupplier.php @@ -0,0 +1,134 @@ + +prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function cari_supplier($nama) { + if($nama != "") { + $harray = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $nama = addslashes($nama); + $data = $mysqli->query("SELECT kd_supplier, nama_supplier, alamat1, lama_tempo FROM supplier WHERE nama_supplier LIKE '%".$nama."%'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_supplier' => $a['kd_supplier'], + 'nama_supplier' => stripcslashes($a['nama_supplier']), + 'alamat1' => $a['alamat1'], + 'lama_tempo' => $a['lama_tempo'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + }else{ + $harray = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $nama = addslashes($nama); + $data = $mysqli->query("SELECT kd_supplier, nama_supplier, alamat1, lama_tempo FROM supplier"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_supplier' => $a['kd_supplier'], + 'nama_supplier' => stripcslashes($a['nama_supplier']), + 'alamat1' => $a['alamat1'], + 'lama_tempo' => $a['lama_tempo'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function ambil_supplier($id_supplier) { + if ($id_supplier != "") { + $array_data = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM supplier WHERE kd_supplier = '".$id_supplier."'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $array_data[$idx] = array( + 'kd_supplier' => $a['kd_supplier'], + 'nama_supplier' => $a['nama_supplier'], + 'alamat1' => $a['alamat1'], + 'alamat2' => $a['alamat2'], + 'nama_rekening' => $a['nama_rekening'], + 'rekening1' => $a['rekening1'], + 'rekening2' => $a['rekening2'], + 'bank1' => $a['bank1'], + 'bank2' => $a['bank2'], + 'telp' => $a['telp'], + 'ponsel' => $a['ponsel'], + 'email' => $a['email'], + 'fax' => $a['fax'], + 'jns_pembayaran' => $a['jns_pembayaran'], + 'lama_tempo' => $a['lama_tempo'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($array_data); + } +} + + +?> \ No newline at end of file diff --git a/old-source/LaporanJual/ak7.php b/old-source/LaporanJual/ak7.php new file mode 100644 index 0000000..9857e05 --- /dev/null +++ b/old-source/LaporanJual/ak7.php @@ -0,0 +1,86 @@ + + + + + :: Pengadaan Barang + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan AK.7 (Pantauan Persediaan) +
+ 1.Pastikan tanggal di komputer server benar sebelum menjalankan laporan ini
+ 2.Laporan harus dijalankan setiap hari, terutama setelah semua proses entry data selesai + +
+
+ + + +
Bulan : [1,2,3,dst] *
Tahun : * +
+ * kolom harus diisi +
+
+
+
+ +
+ + diff --git a/old-source/LaporanJual/bawa.php b/old-source/LaporanJual/bawa.php new file mode 100644 index 0000000..a19a6b8 --- /dev/null +++ b/old-source/LaporanJual/bawa.php @@ -0,0 +1,125 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Rekap Transaksi Bawa +
+ + + + + +
+
+
+ + + + +
Rentang Tanggal: -
Kode Pelanggan : + +
+
+
+
+
+
+ + + + +
Rentang Tanggal: -
Kode Pelanggan : + +
+
+
+
+
+
+ + +
+
Cari Pelanggan
+
+
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+
+ +
+ +
+ + diff --git a/old-source/LaporanJual/detailjual.php b/old-source/LaporanJual/detailjual.php new file mode 100644 index 0000000..b6a123e --- /dev/null +++ b/old-source/LaporanJual/detailjual.php @@ -0,0 +1,80 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Detail Penjualan Per Kategori +
+
+
+ + +
Range Tanggal: s/d
+
+
+
+
+ +
+ + diff --git a/old-source/LaporanJual/fast_move.php b/old-source/LaporanJual/fast_move.php new file mode 100644 index 0000000..17f3bbb --- /dev/null +++ b/old-source/LaporanJual/fast_move.php @@ -0,0 +1,112 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Barang Fast Moving +
+
+
+ + +
Kode Supplier: +
Lini Produk : +
Tgl Pembelian : + s/d * +
+ * kolom harus diisi +
+
+
+
+ +
+
Cari Supplier
+
+ +
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + +
+ + \ No newline at end of file diff --git a/old-source/LaporanJual/jualdlmpdk.php b/old-source/LaporanJual/jualdlmpdk.php new file mode 100644 index 0000000..9cc40f1 --- /dev/null +++ b/old-source/LaporanJual/jualdlmpdk.php @@ -0,0 +1,81 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Penjualan Per Sub Group Product +
+
+
+ + + +
Range Tanggal: s/d
+
+
+
+
+ +
+ + diff --git a/old-source/LaporanJual/jualperkategori.php b/old-source/LaporanJual/jualperkategori.php new file mode 100644 index 0000000..602d901 --- /dev/null +++ b/old-source/LaporanJual/jualperkategori.php @@ -0,0 +1,80 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Penjualan Per Kategori +
+
+
+ + +
Range Tanggal: s/d
+
+
+
+
+ +
+ + diff --git a/old-source/LaporanJual/jualpersupplier.php b/old-source/LaporanJual/jualpersupplier.php new file mode 100644 index 0000000..05675f5 --- /dev/null +++ b/old-source/LaporanJual/jualpersupplier.php @@ -0,0 +1,142 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Penjualan Per Supplier +
+
+
+ + + +
Range Tanggal: s/d
Kode Supplier:
+
+
+
+
+
+ + + +
Range Tanggal: s/d
+
+
+
+ +
+
+ +
+
Cari Supplier
+
+ +
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + +
+ + \ No newline at end of file diff --git a/old-source/LaporanJual/kartu.php b/old-source/LaporanJual/kartu.php new file mode 100644 index 0000000..0eb5b13 --- /dev/null +++ b/old-source/LaporanJual/kartu.php @@ -0,0 +1,81 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Rekap Transaksi Kartu +
+
+
+ + + +
Range Tanggal: s/d
+
+
+
+
+ +
+ + diff --git a/old-source/LaporanJual/kembalibawa.php b/old-source/LaporanJual/kembalibawa.php new file mode 100644 index 0000000..6303acc --- /dev/null +++ b/old-source/LaporanJual/kembalibawa.php @@ -0,0 +1,74 @@ +"; + echo "div#divprint{width:1024px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:950px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $tgl = left($_GET['tgllini'],10); + $lini = right($_GET['tgllini'],2); + + if(bukaKoneksi()){ + global $conn; + $query = "SELECT ((year(curdate()) - b.tahun) * 12) + month(curdate()) - b.bulan usia,DATEDIFF( DATE( m.tgl_kembali ) , DATE( m.tgl_nota ) ) lama_bawa, p.nama, d.no_nota, m.tgl_nota, m.tgl_kembali, d.kd_barang, b.nama_barang, d.no_barang, SUM( d.jumlah ) , SUM( d.jumlah * d.harga_satuan ) rp, SUM( d.jumlah * REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( n.harga_pokok, 'B', '1' ) , 'R', '2' ) , 'A', '3' ) , 'W', '4' ) , 'N', '5' ) , 'F', '6' ) , 'O', '7' ) , 'X', '8' ) , 'E', '9' ) , 'S', '0' ) ) hp, status_barang + FROM d_nota_bawa d, m_nota_bawa m, pelanggan p, barang b, no_barang n + WHERE m.no_nota = d.no_nota + AND b.id_gabungan = n.id_gabungan + AND m.kd_customer = p.kd_customer + AND (d.kd_barang = b.kode_barang AND d.no_barang = n.nomor) + AND b.kode_strip = '$lini' + AND DATE( m.tgl_kembali ) = '$tgl' + GROUP BY CONCAT( d.kd_barang, d.no_barang ) , d.no_nota + ORDER BY DATE( tgl_nota ) , d.no_nota, p.nama, status_barang"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$usia,$lama,$nama,$nota,$tgl,$tglkembali,$brg,$nmbrg,$nobrg,$jml,$rp,$hp,$statusTransaksi); + + print("
"); + print("

Rekap Bawa Barang yang Kembali



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $tthargapokok += $hp; + print(" + + + + "); + } + + print("
Lama Bawa (hari)NamaNo.NotaTgl.NotaTgl.KembaliKode BarangNama BarangNo.BarangJumlahHPHJUsia Brg (bln)Status Transaksi
$lama$nama$nota$tgl$tglkembali$brg$nmbrg$nobrg$jml".number_format($hp, 0, ",", ".")."".number_format($rp, 0, ",", ".")."$usia$statusTransaksi

"); + print(""); + print(""); + print("
Total Harga Pokok : ".number_format($tthargapokok, 0, ",", ".")."
"); + print("
"); + + }else{ + echo "Data tidak ditemukan!"; + } + } + } +?> + diff --git a/old-source/LaporanJual/komposisi.php b/old-source/LaporanJual/komposisi.php new file mode 100644 index 0000000..00033e6 --- /dev/null +++ b/old-source/LaporanJual/komposisi.php @@ -0,0 +1,81 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Rekap Penjualan Komposisi +
+
+
+ + + +
Range Tanggal: s/d
+
+
+
+
+ +
+ + diff --git a/old-source/LaporanJual/konsinyasibawa.php b/old-source/LaporanJual/konsinyasibawa.php new file mode 100644 index 0000000..77ec40d --- /dev/null +++ b/old-source/LaporanJual/konsinyasibawa.php @@ -0,0 +1,295 @@ +"; + echo "div#divprint{width:1024px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:950px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:50px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate3']); + $endDate = decTgl($_POST['endDate3']); + $kodeplg = $_POST['kdplg3']; + + if(bukaKoneksi()){ + global $conn; + IF (strlen($startDate) > 2 && strlen($endDate) > 2 && $kodeplg !=''){ + $query = "select b.kode_supplier, s.nama_supplier, d.no_nota, m.tgl_nota, m.kd_customer, + d.kd_barang,d.no_barang,dp.nm_brg,sum(d.jumlah), + sum(d.jumlah*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp, + sum(d.jumlah*d.harga_satuan) hj,d.kode_pram + from m_nota_bawa m,d_nota_bawa d,no_barang n, barang b, d_pembelian dp, m_pembelian mp, supplier s + where m.status_nota = 'S' + and b.id_gabungan = n.id_gabungan + and b.kode_supplier = s.kd_supplier + and m.no_nota = d.no_nota + and dp.no_faktur = mp.no_faktur + AND left(mp.no_faktur,4) <> 'RVB-' + AND mp.status = 'K' + AND mp.validasi = '1' + AND d.status_barang is NULL + AND (dp.kode_barang = d.kd_barang AND dp.nomor = d.no_barang) + and (d.kd_barang = b.kode_barang and d.no_barang = n.nomor) + and date(m.tgl_nota) BETWEEN '$startDate' and '$endDate' + and m.kd_customer = '$kodeplg' + group by m.no_nota,concat(d.kd_barang,d.no_barang) + order by b.kode_supplier,m.tgl_nota,m.no_nota"; + }elseif ($startDate != '' && $endDate != '' && $kodeplg =='' ){ + $query = "select b.kode_supplier, s.nama_supplier, d.no_nota, m.tgl_nota, m.kd_customer, + d.kd_barang,d.no_barang,dp.nm_brg,sum(d.jumlah), + sum(d.jumlah*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp, + sum(d.jumlah*d.harga_satuan) hj,d.kode_pram + from m_nota_bawa m,d_nota_bawa d,no_barang n, barang b, d_pembelian dp, m_pembelian mp, supplier s + where m.status_nota = 'S' + and b.id_gabungan = n.id_gabungan + and b.kode_supplier = s.kd_supplier + and m.no_nota = d.no_nota + and dp.no_faktur = mp.no_faktur + AND left(mp.no_faktur,4) <> 'RVB-' + AND mp.status = 'K' + AND mp.validasi = '1' + AND d.status_barang is NULL + AND (dp.kode_barang = d.kd_barang AND dp.nomor = d.no_barang) + and (d.kd_barang = b.kode_barang and d.no_barang = n.nomor) + and date(m.tgl_nota) BETWEEN '$startDate' and '$endDate' + group by m.no_nota,concat(d.kd_barang,d.no_barang) + order by b.kode_supplier,m.tgl_nota,m.no_nota"; + }elseif (strlen($startDate) <= 2 && strlen($endDate) <= 2 && $kodeplg !='') { + $query = "select b.kode_supplier, s.nama_supplier, d.no_nota, m.tgl_nota, m.kd_customer, + d.kd_barang,d.no_barang,dp.nm_brg,sum(d.jumlah), + sum(d.jumlah*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp, + sum(d.jumlah*d.harga_satuan) hj,d.kode_pram + from m_nota_bawa m,d_nota_bawa d,no_barang n, barang b, d_pembelian dp, m_pembelian mp, supplier s + where m.status_nota = 'S' + and b.id_gabungan = n.id_gabungan + and b.kode_supplier = s.kd_supplier + and m.no_nota = d.no_nota + and dp.no_faktur = mp.no_faktur + AND left(mp.no_faktur,4) <> 'RVB-' + AND mp.status = 'K' + AND mp.validasi = '1' + AND d.status_barang is NULL + AND (dp.kode_barang = d.kd_barang AND dp.nomor = d.no_barang) + and (d.kd_barang = b.kode_barang and d.no_barang = n.nomor) + and m.kd_customer = '$kodeplg' + group by m.no_nota,concat(d.kd_barang,d.no_barang) + order by b.kode_supplier,m.tgl_nota,m.no_nota"; + } + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdsupp,$namasupp,$nota,$tgl,$kdcust,$kdbrg,$nomor,$namabrg,$jumlah,$hp,$hj,$kasir); + $ttJumlah = array(); + + $ttJumlah['hp'] = 0; + $ttJumlah['hj'] = 0; + print("
"); + print("

Laporan Penjualan - Bawa Barang Konsinyasi



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['hp'] += $hp; + $ttJumlah['hj'] += $hj; + print(" + + "); + } + + print("
Kode SuppNama SuppNo.NotaTgl.NotaKd.PlgKd.BarangNomorNama BrgJumlahHPHJKasir
.$kdsupp$namasupp$nota$tgl.$kdcust$kdbrg$nomor$namabrg$jumlah".number_format($hp, 0, ",", ".")."".number_format($hj, 0, ",", ".")."$kasir

"); + print("
"); + print(""); + print(""); + print("
Total Harga Pokok : ".number_format($ttJumlah['hp'],0,',','.')."
Total Harga Jual : ".number_format($ttJumlah['hj'],0,',','.')."
"); + }else{ + echo "Data tidak ada"; + echo "
"; + } + } + + /*----------------------------------------Penjualan grouping per konveksi per supplier*/ + $query = "SELECT CASE s.kel_jns when 'A' then 'Konveksi' + when 'P' then 'Konveksi' + when 'W' then 'Konveksi' + END kategori, mp.kd_supplier, sp.nama_supplier, sum(d.jumlah) jml, + sum(d.jumlah*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp, + sum(d.jumlah*d.harga_satuan) hj + FROM m_nota_bawa m,d_nota_bawa d,no_barang n, barang b, d_pembelian dp, m_pembelian mp,strip s, supplier sp + WHERE m.status_nota = 'S' + and b.id_gabungan = n.id_gabungan + and mp.kd_supplier = sp.kd_supplier + and s.kd_strip = b.kode_strip + and m.no_nota = d.no_nota + and dp.no_faktur = mp.no_faktur + AND left(mp.no_faktur,4) <> 'RVB-' + AND mp.status = 'K' + AND mp.validasi = '1' + AND s.kel_jns != 'S' + AND d.status_barang is NULL + AND (dp.kode_barang = d.kd_barang AND dp.nomor = d.no_barang) + and (d.kd_barang = b.kode_barang and d.no_barang = n.nomor) + and date(m.tgl_nota) BETWEEN '$startDate' and '$endDate' + GROUP BY kategori,mp.kd_supplier + "; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kat,$kdsupp,$supp,$jml,$hp,$hj); + + print("
"); + print("

Rekap Penjualan Bawa Barang Konsinyasi Kelp.Kategori Konveksi Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("Periode Tanggal : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."


"); + print(""); + print(""); + + $ttHJ = 0; + $ttHP = 0; + $profit = 0; + while(mysqli_stmt_fetch($stmt)){ + $ttHJ += $hj; + $ttHP += $hp; + $profit = ($hj-$hp)/$hj*100; + print(" + "); + } + print(""); + print("
Kelp.KategoriKode SupplierNama SupplierJumlHarga JualHarga PokokProfit[%]
$kat.$kdsupp$supp$jml".number_format($hj,0,',','.')."".number_format($hp,0,',','.')."".number_format($profit,2,',','.')."
T O T A L".number_format($ttHJ,0,',','.')."".number_format($ttHP,0,',','.')."

"); + print("
"); + }else{ + echo "data tdk ada"; + echo "
"; + } + } + /*----------------------------------------Penjualan grouping per sepatu per supplier*/ + $query = "SELECT CASE s.kel_jns when 'S' then 'Sepatu' + END kategori, mp.kd_supplier, sp.nama_supplier, sum(d.jumlah) jml, + sum(d.jumlah*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp, + sum(d.jumlah*d.harga_satuan) hj + FROM m_nota_bawa m,d_nota_bawa d,no_barang n, barang b, d_pembelian dp, m_pembelian mp,strip s, supplier sp + where m.status_nota = 'S' + and b.id_gabungan = n.id_gabungan + and mp.kd_supplier = sp.kd_supplier + and s.kd_strip = b.kode_strip + and m.no_nota = d.no_nota + and dp.no_faktur = mp.no_faktur + AND left(mp.no_faktur,4) <> 'RVB-' + AND mp.status = 'K' + AND mp.validasi = '1' + AND s.kel_jns = 'S' + AND d.status_barang is NULL + AND (dp.kode_barang = d.kd_barang AND dp.nomor = d.no_barang) + and (d.kd_barang = b.kode_barang and d.no_barang = n.nomor) + and date(m.tgl_nota) BETWEEN '$startDate' and '$endDate' + group by kategori,mp.kd_supplier + "; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kat,$kdsupp,$supp,$jml,$hp,$hj); + + print("
"); + print("

Rekap Penjualan Bawa Barang Konsinyasi Kelp.Kategori Sepatu Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("Periode Tanggal : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."


"); + print(""); + print(""); + + $ttHJ = 0; + $ttHP = 0; + $profit = 0; + while(mysqli_stmt_fetch($stmt)){ + $ttHJ += $hj; + $ttHP += $hp; + $profit = ($hj-$hp)/$hj*100; + print(" + "); + } + print(""); + print("
Kelp.KategoriKode SupplierNama SupplierJumlHarga JualHarga PokokProfit[%]
$kat.$kdsupp$supp$jml".number_format($hj,0,',','.')."".number_format($hp,0,',','.')."".number_format($profit,2,',','.')."
T O T A L".number_format($ttHJ,0,',','.')."".number_format($ttHP,0,',','.')."

"); + print("
"); + }else{ + echo "data tdk ada"; + echo "
"; + } + } + /*----------------------------------------Penjualan grouping per supplier*/ + $query = "select mp.kd_supplier, sp.nama_supplier, sum(d.jumlah) jml, + sum(d.jumlah*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp, + sum(d.jumlah*d.harga_satuan) hj + FROM m_nota_bawa m,d_nota_bawa d,no_barang n, barang b, d_pembelian dp, m_pembelian mp,strip s, supplier sp + where m.status_nota = 'S' + and b.id_gabungan = n.id_gabungan + and mp.kd_supplier = sp.kd_supplier + and s.kd_strip = b.kode_strip + and m.no_nota = d.no_nota + and dp.no_faktur = mp.no_faktur + AND left(mp.no_faktur,4) <> 'RVB-' + AND mp.status = 'K' + AND mp.validasi = '1' + AND d.status_barang is NULL + AND (dp.kode_barang = d.kd_barang AND dp.nomor = d.no_barang) + and (d.kd_barang = b.kode_barang and d.no_barang = n.nomor) + and date(m.tgl_nota) BETWEEN '$startDate' and '$endDate' + group by mp.kd_supplier + "; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdsupp,$supp,$jml,$hp,$hj); + + print("
"); + print("

Rekap Penjualan Bawa Barang Konsinyasi Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("Periode Tanggal : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."


"); + print(""); + print(""); + + $ttHJ = 0; + $ttHP = 0; + $profit = 0; + while(mysqli_stmt_fetch($stmt)){ + $ttHJ += $hj; + $ttHP += $hp; + $profit = ($hj-$hp)/$hj*100; + print(" + "); + } + print(""); + print("
Kode SupplierNama SupplierJumlHarga JualHarga PokokProfit[%]
.$kdsupp$supp$jml".number_format($hj,0,',','.')."".number_format($hp,0,',','.')."".number_format($profit,2,',','.')."
T O T A L".number_format($ttHJ,0,',','.')."".number_format($ttHP,0,',','.')."

"); + print("
"); + }else{ + echo "data tdk ada"; + echo "
"; + } + } + } +?> + diff --git a/old-source/LaporanJual/lap_ak7.php b/old-source/LaporanJual/lap_ak7.php new file mode 100644 index 0000000..76fdf57 --- /dev/null +++ b/old-source/LaporanJual/lap_ak7.php @@ -0,0 +1,758 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:100%;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:50px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFFF33;}"; + echo ".warnaBarisTot{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $bulan = $_POST['bulan']; + $tahun = $_POST['tahun']; + $d=cal_days_in_month(CAL_GREGORIAN,$bulan,$tahun); + if ($bulan < 10){ + $startDate = $tahun."-"."0".$bulan."-"."01"; + $endDate = $tahun."-"."0".$bulan."-"."31"; + }else{ + $startDate = $tahun."-".$bulan."-"."01"; + $endDate = $tahun."-".$bulan."-"."31"; + } + + +if(bukaKoneksi()){ + global $conn; + + print("
"); + print("

Laporan AK.7



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".$startDate." s/d ".$endDate."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."

"); + print(" *) Stock Minus : Hanya sebagai notifikasi, tidak turut dalam proses perhitungan apapun "); + print("
"); + print(""); + print(" + + + + + + + + + + + + + + + + "); + //looping untuk insert tanggal ke tabel AK7 + for ($n = 1; $n <= $d; $n++){ + if ($bulan < 10){ + $bln = "0".$bulan; + }else{ + $bln = $bulan; + } + if ($n < 10){ + $tgl = "0".$n; + }else{ + $tgl = $n; + } + $tanggal = $tahun."-".$bln."-".$tgl; + $queryCekTanggal = "Select tanggal From tempAK7 WHERE tanggal = '$tanggal'"; + $resultCekTanggal = runningQuery($queryCekTanggal); + if($resultCekTanggal->num_rows > 0){ + $queryUpdateTanggal = "UPDATE tempAK7 SET tanggal = '$tanggal' WHERE tanggal = '$tanggal'"; + runningQuery($queryUpdateTanggal); + }else{ + $queryInsertTanggal = "INSERT INTO `tempAK7` ( + `tanggal` , + `stockawal` , + `pembelian` , + `revisi` , + `transfer` , + `transferkembali` , + `penjualan` , + `bawa` , + `kembalibawa` , + `stockopname` , + `stockminus` , + `stockakhir` + ) + VALUES ( + '$tanggal', NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL + );"; + runningQuery($queryInsertTanggal); + } + } //end of looping untuk insert tanggal ke tabel AK7 +/*****************************************************************************************************************************************************/ +//cek tgl hari ini utk tabel AK7 +$querycektgl = "Select tanggal From tempAK7 WHERE tanggal = CURDATE()"; +$resultcektgl = runningQuery($querycektgl); +if($resultcektgl->num_rows > 0){ + //kolom pembelian + $querypembelian = "SELECT CURDATE() tgl_masuk, + sum(d.jum_fisik*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + FROM d_pembelian d, m_pembelian m,strip s,barang b + WHERE d.no_faktur = m.no_faktur + AND d.kode_barang = b.kode_barang + AND s.kd_strip = b.kode_strip + AND m.tgl_masuk = CURDATE() + AND m.validasi = '1' + AND m.status_revisi = '1' + GROUP BY m.tgl_masuk"; + $resultpembelian = runningQuery($querypembelian); + if($resultpembelian->num_rows > 0){ + while($pembelian = $resultpembelian->fetch_array(MYSQLI_ASSOC)){ + $tgl_masuk = $pembelian['tgl_masuk']; + $hp = $pembelian['hp']; + $queryUpdatePembelian = "UPDATE tempAK7 SET pembelian = '$hp' WHERE tanggal = '$tgl_masuk'"; + runningQuery($queryUpdatePembelian); + } + } + //kolom Revisi + $queryRevisi = "SELECT CURDATE() tgl_masuk,sum(m.rp_beli) hp + FROM m_pembelian m + WHERE m.validasi = '1' + AND left(m.no_faktur,4) = 'RVB-' + AND m.status_revisi = 0 + AND m.tgl_masuk = CURDATE() + GROUP BY m.tgl_masuk"; + $resultRevisi = runningQuery($queryRevisi); + if($resultRevisi->num_rows > 0){ + while($Revisi = $resultRevisi->fetch_array(MYSQLI_ASSOC)){ + $tgl_masuk = $Revisi['tgl_masuk']; + $hp = $Revisi['hp']; + $queryUpdateRevisi = "UPDATE tempAK7 SET revisi = '$hp' WHERE tanggal = '$tgl_masuk'"; + runningQuery($queryUpdateRevisi); + } + } + //kolom Retur + $queryRetur = "SELECT CURDATE() tgl_retur,sum(d.tot) hp + FROM m_retur_beli r, + (SELECT id_retur,sum(jumlah) jum,sum(jumlah*harga_satuan) tot from d_retur_beli group by id_retur) d + where tgl_retur = CURDATE() + and r.id_retur = d.id_retur + and r.validasi = '1' + GROUP BY r.`tgl_retur`"; + $resultRetur = runningQuery($queryRetur); + if($resultRetur->num_rows > 0){ + while($Retur = $resultRetur->fetch_array(MYSQLI_ASSOC)){ + $tgl_retur = $Retur['tgl_retur']; + $hp = $Retur['hp']; + $queryUpdateRetur = "UPDATE tempAK7 SET retur = '$hp' WHERE tanggal = '$tgl_retur'"; + runningQuery($queryUpdateRetur); + } + } + //kolom Transfer + $queryTransfer = "SELECT CURDATE() tgl_transfer, sum(m.total_transfer) hp + FROM m_transfer m + where date(m.tgl_transfer) = CURDATE() + and m.validasi = '1' + GROUP BY m.`tgl_transfer`"; + $resultTransfer = runningQuery($queryTransfer); + if($resultTransfer->num_rows > 0){ + while($Transfer = $resultTransfer->fetch_array(MYSQLI_ASSOC)){ + $tgl_Transfer = $Transfer['tgl_transfer']; + $hp = $Transfer['hp']; + $queryUpdateTransfer = "UPDATE tempAK7 SET transfer = '$hp' WHERE tanggal = '$tgl_Transfer'"; + runningQuery($queryUpdateTransfer); + } + } + //kolom Transfer kembali + $queryTransferKembali = "SELECT CURDATE() tgl_kembali, sum(m.total_transfer) hp + FROM m_transfer_kembali m + where date(m.tgl_kembali) = CURDATE() + and m.validasi = '1' + GROUP BY m.`tgl_kembali`"; + $resultTransferKembali = runningQuery($queryTransferKembali); + if($resultTransferKembali->num_rows > 0){ + while($TransferKembali = $resultTransferKembali->fetch_array(MYSQLI_ASSOC)){ + $tgl_TransferKembali = $TransferKembali['tgl_kembali']; + $hp = $TransferKembali['hp']; + $queryUpdateTransferKembali = "UPDATE tempAK7 SET transferkembali = '$hp' WHERE tanggal = '$tgl_TransferKembali'"; + runningQuery($queryUpdateTransferKembali); + } + } + //kolom penjualan + $querypenjualan = "SELECT CURDATE() tanggal,sum(hp) totHP + from ( + select date(m.tgl_nota) tanggal, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m + where d.no_nota = m.no_nota + and d.harga_pokok IS NOT NULL + and m.status_nota = 'S' + and date(tgl_nota) = CURDATE() + group by m.tgl_nota + UNION ALL + select date(m.tgl_bon) tanggal, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_bon d,m_bon m + where d.no_bon = m.no_bon + and d.harga_pokok IS NOT NULL + and date(tgl_bon) = CURDATE() + group by m.tgl_bon + UNION ALL + select date(m.tgl_nota) tanggal, + (-1*sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp + from d_nota_retur d,m_nota_retur m + where d.no_nota = m.no_nota + and d.harga_pokok IS NOT NULL + and date(tgl_nota) = CURDATE() + group by m.tgl_nota + ) vlini + group by tanggal"; + $resultpenjualan = runningQuery($querypenjualan); + if($resultpenjualan->num_rows > 0){ + while($penjualan = $resultpenjualan->fetch_array(MYSQLI_ASSOC)){ + $tgl_penjualan = $penjualan['tanggal']; + $hp = $penjualan['totHP']; + $queryUpdatepenjualan = "UPDATE tempAK7 SET penjualan = '$hp' WHERE tanggal = '$tgl_penjualan'"; + runningQuery($queryUpdatepenjualan); + } + } + //kolom bawa + $querybawa = "SELECT CURDATE() tanggal, sum(d.jumlah*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp + from m_nota_bawa m,d_nota_bawa d,no_barang n, barang b + where m.status_nota = 'S' + and m.no_nota = d.no_nota + and b.id_gabungan = n.id_gabungan + and (d.kd_barang = b.kode_barang and d.no_barang = n.nomor) + and date(m.tgl_nota) = CURDATE() + group by date(m.tgl_nota)"; + $resultbawa = runningQuery($querybawa); + if($resultbawa->num_rows > 0){ + while($bawa = $resultbawa->fetch_array(MYSQLI_ASSOC)){ + $tgl_bawa = $bawa['tanggal']; + $hp = $bawa['hp']; + $queryUpdatebawa = "UPDATE tempAK7 SET bawa = '$hp' WHERE tanggal = '$tgl_bawa'"; + runningQuery($queryUpdatebawa); + } + } + //kolom kembalibawa + $querykembalibawa = "SELECT CURDATE() tgl_kembali, SUM( d.jumlah * REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( n.harga_pokok, 'B', '1' ) , 'R', '2' ) , 'A', '3' ) , 'W', '4' ) , 'N', '5' ) , 'F', '6' ) , 'O', '7' ) , 'X', '8' ) , 'E', '9' ) , 'S', '0' ) ) hp + FROM d_nota_bawa d, m_nota_bawa m, pelanggan p, barang b, no_barang n + WHERE m.no_nota = d.no_nota + AND b.id_gabungan = n.id_gabungan + AND m.kd_customer = p.kd_customer + AND (d.kd_barang = b.kode_barang AND d.no_barang = n.nomor) + AND DATE( m.tgl_kembali ) = CURDATE() + GROUP BY DATE(m.tgl_kembali)"; + $resultkembalibawa = runningQuery($querykembalibawa); + if($resultkembalibawa->num_rows > 0){ + while($kembalibawa = $resultkembalibawa->fetch_array(MYSQLI_ASSOC)){ + $tgl_kembalibawa = $kembalibawa['tgl_kembali']; + $hp = $kembalibawa['hp']; + $queryUpdatekembalibawa = "UPDATE tempAK7 SET kembalibawa = '$hp' WHERE tanggal = '$tgl_kembalibawa'"; + runningQuery($queryUpdatekembalibawa); + } + } + //kolom stockopname + $querystockopname = "SELECT CURDATE() tanggal,SUM(d.jumlah_asli*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) - + SUM(d.jumlah_stok_sebelum*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) selisih + from barang b inner join no_barang n on b.id_gabungan = n.id_gabungan + left join d_stock_opname d on (d.kode_barang = b.kode_barang and d.nomor=n.nomor) + inner join m_stock_opname m on (d.no_nota = m.no_nota and b.kode_strip = m.strip) + WHERE DATE(m.tanggal) = CURDATE() + AND m.konfirmasi = '1' + GROUP BY m.tanggal"; + $resultstockopname = runningQuery($querystockopname); + if($resultstockopname->num_rows > 0){ + while($stockopname = $resultstockopname->fetch_array(MYSQLI_ASSOC)){ + $tgl_stockopname = $stockopname['tanggal']; + $hp = $stockopname['selisih']; + $queryUpdatestockopname = "UPDATE tempAK7 SET stockopname = '$hp' WHERE tanggal = '$tgl_stockopname'"; + runningQuery($queryUpdatestockopname); + } + } + //kolom stokmin + $querystokmin = "SELECT CURDATE() tanggal,SUM(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok) + totalHP + from barang b,no_barang n,strip s + WHERE n.stok<0 + and b.id_gabungan = n.id_gabungan + and s.kd_strip = b.kode_strip + "; + $resultstokmin = runningQuery($querystokmin); + if($resultstokmin->num_rows > 0){ + while($stokmin = $resultstokmin->fetch_array(MYSQLI_ASSOC)){ + $tgl_stokmin = $stokmin['tanggal']; + $hp = $stokmin['totalHP']; + $queryUpdatestokmin = "UPDATE tempAK7 SET stockminus = '$hp' WHERE tanggal = '$tgl_stokmin'"; + runningQuery($queryUpdatestokmin); + } + } + //kolom persediaan + $querypersediaan = "SELECT CURDATE() tanggal, + SUM(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok) + totalHP + from barang b,no_barang n,strip s + WHERE n.stok>0 + and b.id_gabungan = n.id_gabungan + and s.kd_strip = b.kode_strip + "; + $resultpersediaan = runningQuery($querypersediaan); + if($resultpersediaan->num_rows > 0){ + while($persediaan = $resultpersediaan->fetch_array(MYSQLI_ASSOC)){ + $tgl_masuk = $persediaan['tanggal']; + $hp = $persediaan['totalHP']; + $queryUpdatepersediaan = "UPDATE tempAK7 SET stockakhir = '$hp' WHERE tanggal = '$tgl_masuk'"; + runningQuery($queryUpdatepersediaan); + } + } + //kolom persediaan awal + $querystokawal = "SELECT DATE_ADD(CURDATE(), INTERVAL -1 DAY) kemarin, stockakhir + FROM tempAK7 + WHERE tanggal = DATE_ADD(CURDATE(), INTERVAL -1 DAY)"; + $resultstokawal = runningQuery($querystokawal); //ambil stockakhir hari kemarin + if($resultstokawal->num_rows > 0){ + while($stokawal = $resultstokawal->fetch_array(MYSQLI_ASSOC)){ + $kemarin = $stokawal['kemarin']; + $hp = $stokawal['stockakhir']; + $queryUpdatestokawal = "UPDATE tempAK7 SET stockawal = '$hp' WHERE tanggal = CURDATE()"; + runningQuery($queryUpdatestokawal); //update stockawal hari ini dengan stockahir hari kemarin + } + } + +}//end of cek tgl hari ini utk tabel AK7 + +/***************************************************************************************************************************************************/ +//URUSAN AK7Rinci +//cek tgl hari ini di AK7rinci + $querycektanggalrinci = "Select tanggal From tempAK7rinci WHERE tanggal = CURDATE()"; + $resultcektanggalrinci = runningQuery($querycektanggalrinci); + if($resultcektanggalrinci->num_rows > 0){ //kalo ada di update + updateData(); + }else{ //kalo ga ada => diInsert + $queryAmbilStrip = "SELECT CURDATE() hariini, s.kd_strip FROM strip s"; + $resultAmbilStrip = runningQuery($queryAmbilStrip); + if($resultAmbilStrip->num_rows > 0){ + while($strip = $resultAmbilStrip->fetch_array(MYSQLI_ASSOC)){ + $hariini = $strip['hariini']; + $lini = $strip['kd_strip']; + $queryInsertTanggal = "INSERT INTO `tempAK7rinci` ( + `tanggal` , + `lini`, + `stockawal` , + `pembelian` , + `revisi` , + `transfer` , + `transferkembali` , + `penjualan` , + `bawa` , + `kembalibawa` , + `stockopname` , + `stockminus` , + `stockakhir` + ) + VALUES ( + '$hariini', '$lini', NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL + );"; + runningQuery($queryInsertTanggal); + } + } + //lalu diUpdate + updateData(); + } + + +/***************************************************************************************************************************************************/ + //Tampilkan AK7 + $queryView = "SELECT * FROM tempAK7 WHERE tanggal BETWEEN '$startDate' AND '$endDate' ORDER BY id"; + $resultView = runningQuery($queryView); + if($resultView->num_rows > 0){ + $ttstockawal = 0; + $ttpembelian = 0; + $ttrevisi = 0; + $ttretur = 0; + $tttransfer = 0; + $tttransferkembali = 0; + $ttpenjualan = 0; + $ttbawa = 0; + $ttkembalibawa = 0; + $ttstockopname = 0; + $ttperhitungan = 0; + $ttstockakhir = 0; + $ttselisih = 0; + + while($View = $resultView->fetch_array(MYSQLI_ASSOC)){ + $tanggal = $View['tanggal']; + $stockawal = $View['stockawal']; + $pembelian = $View['pembelian']; + $revisi = $View['revisi']; + $retur = $View['retur']; + $transfer = $View['transfer']; + $transferkembali = $View['transferkembali']; + $penjualan = $View['penjualan']; + $bawa = $View['bawa']; + $kembalibawa = $View['kembalibawa']; + $stockopname = $View['stockopname']; + $stockmin = $View['stockminus']; + $perhitungan = $stockawal + $pembelian + $revisi - $retur - $transfer + $transferkembali - $penjualan - $bawa + $kembalibawa + $stockopname ; + $stockakhir = $View['stockakhir']; + $selisih = $perhitungan - $stockakhir; + + $ttstockawal += $stockawal; + $ttpembelian += $pembelian; + $ttrevisi += $revisi; + $ttretur += $retur; + $tttransfer += $transfer; + $tttransferkembali += $transferkembali; + $ttpenjualan += $penjualan; + $ttbawa += $bawa; + $ttkembalibawa += $kembalibawa; + $ttstockopname += $stockopname; + $ttperhitungan += $perhitungan; + $ttstockakhir += $stockakhir; + $ttselisih += $selisih; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + } + print(" + + + + + + + + + + + + + + + "); + //end of tampilkan + + print("
TanggalStock AwalPembelianRevisiReturTransferTransfer KembaliPenjualanBawa DuluKembali Bawa DuluStock OpnameStock Minus*)Stock(hsl perhitungan)Stock(komp)Selisih
$tanggal".number_format( $stockawal,0,",",".")."".number_format( $pembelian,0,",",".")."".number_format( $revisi,0,",",".")."".number_format( $retur,0,",",".")."".number_format( $transfer,0,",",".")."".number_format( $transferkembali,0,",",".")."".number_format( $penjualan,0,",",".")."".number_format( $bawa,0,",",".")."".number_format( $kembalibawa,0,",",".")."".number_format( $stockopname,0,",",".")."".number_format( $stockmin,0,",",".")."".number_format( $perhitungan,0,",",".")."".number_format( $stockakhir,0,",",".")."".number_format( $selisih,0,",",".")."
T O T A L".number_format( $ttstockawal,0,",",".")."".number_format( $ttpembelian,0,",",".")."".number_format( $ttrevisi,0,",",".")."".number_format( $ttretur,0,",",".")."".number_format( $tttransfer,0,",",".")."".number_format( $tttransferkembali,0,",",".")."".number_format( $ttpenjualan,0,",",".")."".number_format( $ttbawa,0,",",".")."".number_format( $ttkembalibawa,0,",",".")."".number_format( $ttstockopname,0,",",".")."".number_format( $ttperhitungan,0,",",".")."".number_format( $ttstockakhir,0,",",".")."".number_format( $ttselisih,0,",",".")."

"); + print("
"); +} + + +function updateData(){ //update data di tabel AK7rinci + //ak7rinci stockakhir + $querypersediaan2 = "SELECT CURDATE() tanggal,b.kode_strip, + SUM(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok) + totalHP + from barang b,no_barang n,strip s + WHERE n.stok>0 + and b.id_gabungan = n.id_gabungan + and s.kd_strip = b.kode_strip + GROUP BY b.kode_strip + "; + $resultpersediaan2 = runningQuery($querypersediaan2); + if($resultpersediaan2->num_rows > 0){ + while($persediaan = $resultpersediaan2->fetch_array(MYSQLI_ASSOC)){ + $tanggal = $persediaan['tanggal']; + $lini = $persediaan['kode_strip']; + $hp = $persediaan['totalHP']; + $queryUpdatestokakhir = "UPDATE tempAK7rinci SET stockakhir = '$hp' WHERE tanggal = '$tanggal' AND lini = '$lini'"; + runningQuery($queryUpdatestokakhir); + + } + } + //ak7rinci pembelian + $querypembelian2 = "SELECT CURDATE() tanggal,s.kd_strip, + sum(d.jum_fisik*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + FROM d_pembelian d, m_pembelian m,strip s,barang b + WHERE d.no_faktur = m.no_faktur + AND d.kode_barang = b.kode_barang + AND s.kd_strip = b.kode_strip + AND m.tgl_masuk = CURDATE() + AND m.validasi = '1' + AND m.status_revisi = '1' + GROUP BY s.kd_strip"; + $resultpembelian2 = runningQuery($querypembelian2); + if($resultpembelian2->num_rows > 0){ + while($pembelian2 = $resultpembelian2->fetch_array(MYSQLI_ASSOC)){ + $tanggal = $pembelian2['tanggal']; + $lini = $pembelian2['kd_strip']; + $hp = $pembelian2['hp']; + $queryUpdatePembelian2 = "UPDATE tempAK7rinci SET pembelian = '$hp' WHERE tanggal = '$tanggal' AND lini = '$lini'"; + runningQuery($queryUpdatePembelian2); + + } + } + //ak7rinci revisi + $queryrevisi2 = "SELECT CURDATE() tanggal,s.kd_strip, + sum(d.jum_fisik*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + FROM d_pembelian d, m_pembelian m,strip s,barang b + WHERE d.no_faktur = m.no_faktur + AND d.kode_barang = b.kode_barang + AND s.kd_strip = b.kode_strip + AND m.validasi = '1' + AND m.status_revisi = 0 + AND left(m.no_faktur,4) = 'RVB-' + AND m.tgl_masuk = CURDATE() + GROUP BY s.kd_strip + "; + $resultrevisi2 = runningQuery($queryrevisi2); + if($resultrevisi2->num_rows > 0){ + while($revisi2 = $resultrevisi2->fetch_array(MYSQLI_ASSOC)){ + $tanggal = $revisi2['tanggal']; + $lini = $revisi2['kd_strip']; + $hp = $revisi2['hp']; + $queryUpdaterevisi2 = "UPDATE tempAK7rinci SET revisi = '$hp' WHERE tanggal = '$tanggal' AND lini = '$lini'"; + runningQuery($queryUpdaterevisi2); + + } + } + //ak7rinci retur beli + $queryretur2 = "SELECT CURDATE() tanggal, s.kd_strip,sum(dr.jumlah*dr.harga_satuan) hp + from m_retur_beli r,d_retur_beli dr,strip s, barang b + where r.tgl_retur = CURDATE() + and dr.kd_barang = b.kode_barang + and r.id_retur = dr.id_retur + and b.kode_strip = s.kd_strip + and r.validasi = '1' + GROUP BY s.kd_strip + "; + $resultretur2 = runningQuery($queryretur2); + if($resultretur2->num_rows > 0){ + while($retur2 = $resultretur2->fetch_array(MYSQLI_ASSOC)){ + $tanggal = $retur2['tanggal']; + $lini = $retur2['kd_strip']; + $hp = $retur2['hp']; + $queryUpdateretur2 = "UPDATE tempAK7rinci SET retur = '$hp' WHERE tanggal = '$tanggal' AND lini = '$lini'"; + runningQuery($queryUpdateretur2); + + } + } + //ak7rinci transfer + $querytransfer2 = "SELECT CURDATE() tanggal, s.kd_strip, sum(d.jumlah*d.harga_satuan) hp + FROM m_transfer m, d_transfer d, strip s, barang b + where + m.id_transfer = d.id_transfer + AND d.kode_barang_nota = b.kode_barang + AND s.kd_strip = b.kode_strip + and date(m.tgl_transfer) = CURDATE() + and m.validasi = '1' + GROUP BY s.kd_strip + "; + $resulttransfer2 = runningQuery($querytransfer2); + if($resulttransfer2->num_rows > 0){ + while($transfer2 = $resulttransfer2->fetch_array(MYSQLI_ASSOC)){ + $tanggal = $transfer2['tanggal']; + $lini = $transfer2['kd_strip']; + $hp = $transfer2['hp']; + $queryUpdatetransfer2 = "UPDATE tempAK7rinci SET transfer = '$hp' WHERE tanggal = '$tanggal' AND lini = '$lini'"; + runningQuery($queryUpdatetransfer2); + + } + } + //ak7rinci transfer kembali + $querytransferkembali2 = "SELECT CURDATE() tanggal, s.kd_strip, sum(d.jumlah*d.harga_satuan) hp + FROM m_transfer_kembali m, d_transfer_kembali d, strip s, barang b + where + m.id_transfer = d.id_transfer + AND d.kode_barang_nota = b.kode_barang + AND s.kd_strip = b.kode_strip + and date(m.tgl_kembali) = CURDATE() + and m.validasi = '1' + GROUP BY s.kd_strip + "; + $resulttransferkembali2 = runningQuery($querytransferkembali2); + if($resulttransferkembali2->num_rows > 0){ + while($transferkembali2 = $resulttransferkembali2->fetch_array(MYSQLI_ASSOC)){ + $tanggal = $transferkembali2['tanggal']; + $lini = $transferkembali2['kd_strip']; + $hp = $transferkembali2['hp']; + $queryUpdatetransferkembali2 = "UPDATE tempAK7rinci SET transferkembali = '$hp' WHERE tanggal = '$tanggal' AND lini = '$lini'"; + runningQuery($queryUpdatetransferkembali2); + + } + } + //ak7rinci penjualan + $querypenjualan2 = "select CURDATE() tanggal, lini, sum(hp) totHP + from ( + select b.kode_strip lini,sum(jumlah) juml, + sum(d.harga_jual * d.jumlah) hjbruto, + sum(d.harga_jual * d.jumlah * d.diskon / 100) disc, + sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m, barang b + where d.no_nota = m.no_nota + and d.kd_barang = b.kode_barang + and d.harga_pokok IS NOT NULL + and m.status_nota = 'S' + and date(tgl_nota) = CURDATE() + group by b.kode_strip + UNION ALL + select b.kode_strip lini,sum(jumlah) juml, + sum(d.hrg_satuan * d.jumlah) hjbruto, + sum(d.hrg_satuan * d.jumlah * d.diskon / 100) disc, + sum((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_bon d,m_bon m, barang b + where d.no_bon = m.no_bon + and d.kd_brg = b.kode_barang + and d.harga_pokok IS NOT NULL + and date(tgl_bon) = CURDATE() + group by b.kode_strip + UNION ALL + select b.kode_strip lini,(-1*sum(jumlah)) juml, + (-1*sum(d.harga_jual * d.jumlah)) hjbruto, + (-1*sum(d.harga_jual * d.jumlah * d.diskon / 100)) disc, + (-1*sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100))) tot, + (-1*sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp + from d_nota_retur d,m_nota_retur m, barang b + where d.no_nota = m.no_nota + and d.kd_barang = b.kode_barang + and d.harga_pokok IS NOT NULL + and date(tgl_nota) = CURDATE() + group by b.kode_strip + ) vlini,strip s + where s.kd_strip = lini + group by lini + "; + $resultpenjualan2 = runningQuery($querypenjualan2); + if($resultpenjualan2->num_rows > 0){ + while($penjualan2 = $resultpenjualan2->fetch_array(MYSQLI_ASSOC)){ + $tanggal = $penjualan2['tanggal']; + $lini = $penjualan2['lini']; + $hp = $penjualan2['totHP']; + $queryUpdatepenjualan2 = "UPDATE tempAK7rinci SET penjualan = '$hp' WHERE tanggal = '$tanggal' AND lini = '$lini'"; + runningQuery($queryUpdatepenjualan2); + + } + } + //ak7rinci bawa dulu + $querybawa2 = "SELECT CURDATE() tanggal, s.kd_strip, + sum(d.jumlah*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp + from m_nota_bawa m,d_nota_bawa d,no_barang n, barang b, strip s + where m.status_nota = 'S' + and m.no_nota = d.no_nota + and b.kode_strip = s.kd_strip + and b.id_gabungan = n.id_gabungan + and (d.kd_barang = b.kode_barang and d.no_barang = n.nomor) + and date(m.tgl_nota) = CURDATE() + group by s.kd_strip + "; + $resultbawa2 = runningQuery($querybawa2); + if($resultbawa2->num_rows > 0){ + while($bawa2 = $resultbawa2->fetch_array(MYSQLI_ASSOC)){ + $tanggal = $bawa2['tanggal']; + $lini = $bawa2['kd_strip']; + $hp = $bawa2['hp']; + $queryUpdatebawa2 = "UPDATE tempAK7rinci SET bawa = '$hp' WHERE tanggal = '$tanggal' AND lini = '$lini'"; + runningQuery($queryUpdatebawa2); + + } + } + //ak7rinci kembali bawa dulu + $querykembalibawa2 = "SELECT CURDATE() tanggal, s.kd_strip, + SUM( d.jumlah * REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( n.harga_pokok, 'B', '1' ) , 'R', '2' ) , 'A', '3' ) , 'W', '4' ) , 'N', '5' ) , 'F', '6' ) , 'O', '7' ) , 'X', '8' ) , 'E', '9' ) , 'S', '0' ) ) hp + FROM d_nota_bawa d, m_nota_bawa m, pelanggan p, barang b, no_barang n, strip s + WHERE m.no_nota = d.no_nota + AND b.id_gabungan = n.id_gabungan + AND m.kd_customer = p.kd_customer + AND b.kode_strip = s.kd_strip + AND (d.kd_barang = b.kode_barang AND d.no_barang = n.nomor) + AND DATE( m.tgl_kembali ) = CURDATE() + GROUP BY s.kd_strip + "; + $resultkembalibawa2 = runningQuery($querykembalibawa2); + if($resultkembalibawa2->num_rows > 0){ + while($kembalibawa2 = $resultkembalibawa2->fetch_array(MYSQLI_ASSOC)){ + $tanggal = $kembalibawa2['tanggal']; + $lini = $kembalibawa2['kd_strip']; + $hp = $kembalibawa2['hp']; + $queryUpdatekembalibawa2 = "UPDATE tempAK7rinci SET kembalibawa = '$hp' WHERE tanggal = '$tanggal' AND lini = '$lini'"; + runningQuery($queryUpdatekembalibawa2); + + } + } + //ak7rinci stockopname + $querystockopname2 = "SELECT CURDATE() tanggal, s.kd_strip, SUM(d.jumlah_asli*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) - + SUM(d.jumlah_stok_sebelum*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) selisih + from barang b inner join no_barang n on b.id_gabungan = n.id_gabungan + left join d_stock_opname d on (d.kode_barang = b.kode_barang and d.nomor=n.nomor) + inner join m_stock_opname m on (d.no_nota = m.no_nota and left(d.kode_barang,2) = m.strip) + inner join strip s on (m.strip = s.kd_strip) + WHERE DATE(m.tanggal) = CURDATE() + AND m.konfirmasi = '1' + GROUP BY s.kd_strip + "; + $resultstockopname2 = runningQuery($querystockopname2); + if($resultstockopname2->num_rows > 0){ + while($stockopname2 = $resultstockopname2->fetch_array(MYSQLI_ASSOC)){ + $tanggal = $stockopname2['tanggal']; + $lini = $stockopname2['kd_strip']; + $hp = $stockopname2['selisih']; + $queryUpdatestockopname2 = "UPDATE tempAK7rinci SET stockopname = '$hp' WHERE tanggal = '$tanggal' AND lini = '$lini'"; + runningQuery($queryUpdatestockopname2); + + } + } + //ak7rinci stockmin + $querystockmin2 = "SELECT CURDATE() tanggal, b.kode_strip, + SUM(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok) + totalHP + from barang b,no_barang n,strip s + WHERE n.stok<0 + and b.id_gabungan = n.id_gabungan + and s.kd_strip = b.kode_strip + GROUP BY b.kode_strip + "; + $resultstockmin2 = runningQuery($querystockmin2); + if($resultstockmin2->num_rows > 0){ + while($stockmin2 = $resultstockmin2->fetch_array(MYSQLI_ASSOC)){ + $tanggal = $stockmin2['tanggal']; + $lini = $stockmin2['kode_strip']; + $hp = $stockmin2['totalHP']; + $queryUpdatestockmin2 = "UPDATE tempAK7rinci SET stockminus = '$hp' WHERE tanggal = '$tanggal' AND lini = '$lini'"; + runningQuery($queryUpdatestockmin2); + + } + } + //ak7rinci stockawal + $querystokawal = "SELECT DATE_ADD(CURDATE(), INTERVAL -1 DAY) kemarin, lini, stockakhir + FROM tempAK7rinci + WHERE tanggal = DATE_ADD(CURDATE(), INTERVAL -1 DAY)"; + $resultstokawal = runningQuery($querystokawal); //ambil stockakhir hari kemarin + if($resultstokawal->num_rows > 0){ + while($stokawal = $resultstokawal->fetch_array(MYSQLI_ASSOC)){ + $kemarin = $stokawal['kemarin']; + $lini = $stokawal['lini']; + $hp = $stokawal['stockakhir']; + $queryUpdatestokawal = "UPDATE tempAK7rinci SET stockawal = '$hp' WHERE tanggal = CURDATE() and lini = '$lini'"; + runningQuery($queryUpdatestokawal); //update stockawal hari ini dg stockakhir hari kemarin + } + } + +} +?> diff --git a/old-source/LaporanJual/lap_ak7rinci.php b/old-source/LaporanJual/lap_ak7rinci.php new file mode 100644 index 0000000..a1543e9 --- /dev/null +++ b/old-source/LaporanJual/lap_ak7rinci.php @@ -0,0 +1,148 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:100%;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:50px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFFF33;}"; + echo ".warnaBarisTot{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $tgl = $_GET['tgl']; + +if(bukaKoneksi()){ + global $conn; + + print("
"); + print("

Laporan AK.7 Rinci



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("Tanggal : ".$tgl."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."

"); + print(" *) Stock Minus : Hanya sebagai notifikasi, tidak turut dalam proses perhitungan apapun "); + print("
"); + print(""); + print(" + + + + + + + + + + + + + + + + "); + + + //Tampilkan AK7rinci + $queryView = "SELECT * FROM tempAK7rinci WHERE tanggal = '$tgl' order by id"; + $resultView = runningQuery($queryView); + if($resultView->num_rows > 0){ + $ttstockawal = 0; + $ttpembelian = 0; + $ttrevisi = 0; + $ttretur = 0; + $tttransfer = 0; + $tttransferkembali = 0; + $ttpenjualan = 0; + $ttbawa = 0; + $ttkembalibawa = 0; + $ttstockopname = 0; + $ttstockminus = 0; + $ttperhitungan = 0; + $ttstockakhir = 0; + $ttselisih = 0; + + while($View = $resultView->fetch_array(MYSQLI_ASSOC)){ + $tanggal = $View['tanggal']; + $lini = $View['lini']; + $stockawal = $View['stockawal']; + $pembelian = $View['pembelian']; + $revisi = $View['revisi']; + $retur = $View['retur']; + $transfer = $View['transfer']; + $transferkembali = $View['transferkembali']; + $penjualan = $View['penjualan']; + $bawa = $View['bawa']; + $kembalibawa = $View['kembalibawa']; + $stockopname = $View['stockopname']; + $stockmin = $View['stockminus']; + $perhitungan = $stockawal + $pembelian + $revisi - $retur - $transfer + $transferkembali - $penjualan - $bawa + $kembalibawa + $stockopname ; + $stockakhir = $View['stockakhir']; + $selisih = $perhitungan - $stockakhir; + + $ttstockawal += $stockawal; + $ttpembelian += $pembelian; + $ttrevisi += $revisi; + $ttretur += $retur; + $tttransfer += $transfer; + $tttransferkembali += $transferkembali; + $ttpenjualan += $penjualan; + $ttbawa += $bawa; + $ttkembalibawa += $kembalibawa; + $ttstockopname += $stockopname; + $ttstockmin += $stockmin; + $ttperhitungan += $perhitungan; + $ttstockakhir += $stockakhir; + $ttselisih += $selisih; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + } + } + print(" + + + + + + + + + + + + + + + "); + + print("
LiniStock AwalPembelianRevisiReturTransferTransfer KembaliPenjualanBawa DuluKembali Bawa DuluStock OpnameStock Minus*)Stock(hsl perhitungan)Stock(komp)Selisih
$lini".number_format( $stockawal,0,",",".")."".number_format($pembelian,0,",",".")."".number_format($revisi,0,",",".")."".number_format($retur,0,",",".")."".number_format($transfer,0,",",".")."".number_format($transferkembali,0,",",".")."".number_format($penjualan,0,",",".")."".number_format($bawa,0,",",".")."".number_format($kembalibawa,0,",",".")."".number_format($stockopname,0,",",".")."".number_format($stockmin,0,",",".")."".number_format( $perhitungan,0,",",".")."".number_format( $stockakhir,0,",",".")."".number_format( $selisih,0,",",".")."
T O T A L".number_format( $ttstockawal,0,",",".")."".number_format( $ttpembelian,0,",",".")."".number_format( $ttrevisi,0,",",".")."".number_format( $ttretur,0,",",".")."".number_format( $tttransfer,0,",",".")."".number_format( $tttransferkembali,0,",",".")."".number_format( $ttpenjualan,0,",",".")."".number_format( $ttbawa,0,",",".")."".number_format( $ttkembalibawa,0,",",".")."".number_format( $ttstockopname,0,",",".")."".number_format( $ttstockmin,0,",",".")."".number_format( $ttperhitungan,0,",",".")."".number_format( $ttstockakhir,0,",",".")."".number_format( $ttselisih,0,",",".")."

"); + print("
"); + +} +?> \ No newline at end of file diff --git a/old-source/LaporanJual/lap_fastmoving.php b/old-source/LaporanJual/lap_fastmoving.php new file mode 100644 index 0000000..1d7986e --- /dev/null +++ b/old-source/LaporanJual/lap_fastmoving.php @@ -0,0 +1,215 @@ +"; + echo "div#divprint{width:1100px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:1000px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".warnaKolPisah{font-weight : bold; background-color: #595454;}"; //#413839 + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $curdate = date('Y-m-d'); + $supp = $_POST['kdsupp']; + $lini = $_POST['lini']; + + if(bukaKoneksi()){ + global $conn; + + print("
"); + print("

Rekap Barang Fast Moving (B.2)



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("Periode Pembelian : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + $kelJenis[0] = 'MURAH'; + $kelJenis[1] = 'SEDANG'; + $kelJenis[2] = 'MAHAL'; + + $queryclear1 ="DROP TABLE IF EXISTS vLaporan1"; + $queryclear2 ="DROP TABLE IF EXISTS vLaporan2"; + $queryclear3 ="DROP TABLE IF EXISTS vLaporan3"; + + runQuery($queryclear1); + runQuery($queryclear2); + runQuery($queryclear3); + + $qry_filter1 = "CREATE TABLE vLaporan1 AS + SELECT m.kd_supplier,s.nama_supplier,d.kode_barang,d.nm_brg,sum(d.jum_fisik) jmlbeli + FROM d_pembelian d,m_pembelian m,supplier s + WHERE d.no_faktur = m.no_faktur + AND left(m.no_faktur,4) <> 'RVB-' + AND m.kd_supplier = s.kd_supplier + AND date(m.tgl_masuk) between '$startDate' and '$endDate' + GROUP BY d.kode_barang "; + + $qry_filter2 = "CREATE TABLE vLaporan2 AS + SELECT + CASE + WHEN nb.harga_jual >= st.murah1 AND nb.harga_jual <= st.murah2 THEN 'MURAH' + WHEN nb.harga_jual >= st.sedang1 AND nb.harga_jual <= st.sedang2 THEN 'SEDANG' + WHEN nb.harga_jual >= st.mahal1 AND nb.harga_jual <= st.mahal2 THEN 'MAHAL' ELSE 'UNKNOWN' END as komposisi, + b.kode_barang, sum(nb.stok) stokakh, nb.harga_jual hj, b.kode_strip + FROM barang b,no_barang nb,strip st + WHERE + b.id_gabungan = nb.id_gabungan + AND st.kd_strip = b.kode_strip + AND b.kode_barang IN + (select distinct d.kode_barang + from d_pembelian d,m_pembelian m + where d.no_faktur = m.no_faktur + AND left(m.no_faktur,4) <> 'RVB-' + and date(m.tgl_masuk) between '$startDate' and '$endDate') + GROUP BY b.kode_barang "; + + $qry_filter3 = "CREATE TABLE vLaporan3 AS + SELECT vJual.kd_barang,sum(vJual.jumlah) jmljual + FROM + (SELECT d.kd_barang kd_barang,sum(d.jumlah) jumlah + FROM d_nota_tunai d,m_nota_tunai m + WHERE d.no_nota = m.no_nota + AND m.status_nota = 'S' + AND d.kd_barang IN + (select distinct d.kode_barang + from d_pembelian d,m_pembelian m + where d.no_faktur = m.no_faktur + AND left(m.no_faktur,4) <> 'RVB-' + and date(m.tgl_masuk) between '$startDate' and '$endDate') + AND date(m.tgl_nota) BETWEEN '$startDate' AND '$curdate' + GROUP BY d.kd_barang + UNION ALL + SELECT d.kd_brg kd_barang,sum(d.jumlah) jumlah + FROM d_bon d,m_bon m + WHERE d.no_bon = m.no_bon + AND d.kd_brg IN + (select distinct d.kode_barang + from d_pembelian d,m_pembelian m + where d.no_faktur = m.no_faktur + AND left(m.no_faktur,4) <> 'RVB-' + and date(m.tgl_masuk) between '$startDate' and '$endDate') + AND date(m.tgl_bon) BETWEEN '$startDate' AND '$curdate' + GROUP BY d.kd_brg + UNION ALL + SELECT d.kd_barang kd_barang,(-1*sum(d.jumlah)) jumlah + FROM d_nota_retur d,m_nota_retur m + WHERE d.no_nota = m.no_nota + AND d.kd_barang IN + (select distinct d.kode_barang + from d_pembelian d,m_pembelian m + where d.no_faktur = m.no_faktur + AND left(m.no_faktur,4) <> 'RVB-' + and date(m.tgl_masuk) between '$startDate' and '$endDate') + AND date(m.tgl_nota) BETWEEN '$startDate' AND '$curdate' + GROUP BY d.kd_barang) vJual + GROUP BY vJual.kd_barang "; + $qry_index1 = "ALTER TABLE vLaporan1 ADD INDEX brg_supp ( kd_supplier , kode_barang )"; + $qry_index2 = "ALTER TABLE vLaporan2 ADD INDEX kdbrg ( kode_barang )"; + $qry_index3 = "ALTER TABLE vLaporan3 ADD INDEX kdbrg( kd_barang )"; + + runQuery($qry_filter1); + runQuery($qry_index1); + runQuery($qry_filter2); + runQuery($qry_index2); + runQuery($qry_filter3); + runQuery($qry_index3); + + for ($n = 0; $n < 3; $n++){ + + $queryclear ="DROP TABLE IF EXISTS vLaporan"; + runQuery($queryclear); + + + $qry_filter = "CREATE TABLE vLaporan AS + SELECT v1.kd_supplier,v1.nama_supplier,v1.kode_barang,v1.nm_brg,v1.jmlbeli,v3.jmljual,v2.stokakh,v2.hj,v2.kode_strip + FROM vLaporan1 v1 + INNER JOIN vLaporan2 v2 + ON v1.kode_barang = v2.kode_barang + INNER JOIN vLaporan3 v3 + ON v1.kode_barang = v3.kd_barang + WHERE v2.komposisi = '$kelJenis[$n]' + ORDER BY v1.kd_supplier,v1.kode_barang"; + runQuery($qry_filter); + + $qry_index = "ALTER TABLE vLaporan ADD INDEX brg_supp ( kd_supplier , kode_barang )"; + runQuery($qry_index); + + if($supp!= "" AND $lini != "" AND $startDate!= ""){ + $query = "SELECT v.kd_supplier,v.nama_supplier,v.kode_barang,v.nm_brg,v.jmlbeli,v.jmljual,v.stokakh,v.hj,v.kode_strip + FROM vLaporan v + WHERE v.kd_supplier = '$supp' + AND v.kode_strip = '$lini'"; + }else if($supp!= "" AND $startDate!= ""){ + $query = "SELECT v.kd_supplier,v.nama_supplier,v.kode_barang,v.nm_brg,v.jmlbeli,v.jmljual,v.stokakh,v.hj,v.kode_strip + FROM vLaporan v + WHERE v.kd_supplier = '$supp'"; + }else if($lini!= "" AND $startDate!= ""){ + $query = "SELECT v.kd_supplier,v.nama_supplier,v.kode_barang,v.nm_brg,v.jmlbeli,v.jmljual,v.stokakh,v.hj,v.kode_strip + FROM vLaporan v + WHERE v.kode_strip = '$lini'"; + }else{ + $query = "SELECT v.kd_supplier,v.nama_supplier,v.kode_barang,v.nm_brg,v.jmlbeli,v.jmljual,v.stokakh,v.hj,v.kode_strip + FROM vLaporan v"; + } + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdSup,$nmSup,$kdbrg,$nmbrg,$jmlbeli,$jmljual,$stok,$hj,$kdstrip); + + echo ""; + $stripPrev = ""; + $awal = TRUE; + + while(mysqli_stmt_fetch($stmt)){ + $tmpshow = 0.10 * $jmlbeli; + $show = round($tmpshow); + if($jmljual>=$show){ + echo ""; + if ($awal){ + $stripPrev = $kdSup; + } + if ($stripPrev == $kdSup){ + if ($awal){ + echo ""; + }else{ + echo ""; + } + }else{ + echo ""; + } + $awal = FALSE; + $stripPrev = $kdSup; + + print(""); + } + + } + } + } + } + + print("
Kode Supp.Nama SupplierLini ProdukKd.barangNama BarangJml BeliJml JualStok AkhirHJ Satuan

$kelJenis[$n]
" .$kdSup. "" .$nmSup. "
" .$kdSup. "" .$nmSup. "".$kdstrip."".$kdbrg."".$nmbrg."".$jmlbeli."".$jmljual."".$stok."".number_format($hj, 0, ",", ".")."

"); + print("
"); + + } +?> diff --git a/old-source/LaporanJual/lapdetailjual.php b/old-source/LaporanJual/lapdetailjual.php new file mode 100644 index 0000000..bd89cbc --- /dev/null +++ b/old-source/LaporanJual/lapdetailjual.php @@ -0,0 +1,437 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:700px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFFF33;}"; + echo ".warnaBarisTot{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $tanggal = encTgl($startDate); + $bulan = substr($tanggal,3,2); + $tmpbulan = left($bulan,1); + if($tmpbulan == '0'){ + $bln = right($bulan,1); + }else{ + $bln = $bulan; + } + $thn = substr($tanggal,6,4); + + + if(bukaKoneksi()){ + global $conn; +/*------------------------------------------------------------------------------------ tunai -----------------------------------------------------*/ + $query="select s.nama_strip,sum(hp) totHP,sum(hj) totHJ,sum(disc) totDisc,sum(hjnet) totHJnet + from (select b.kode_strip lini,sum(d.harga_jual * d.jumlah) hj,sum(d.harga_jual * d.jumlah * d.diskon / 100) disc,sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) hjnet, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m, barang b + where d.no_nota = m.no_nota + and d.kd_barang = b.kode_barang + and d.harga_pokok IS NOT NULL + and m.status_nota = 'S' + and m.status_bayar != 'K' + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip + ) vtunai, strip s + where s.kd_strip = lini + group by s.kd_strip"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$keljns,$hp,$hj,$disc,$hjnet); + $ttJumlah = array(); + $ttJumlah['hp1'] = 0; + $ttJumlah['hj1'] = 0; + $ttJumlah['disc1'] = 0; + $ttJumlah['hjnet1'] = 0; + + print("
"); + print("

Transaksi Tunai



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); ?> + +"); + print("KategoriTotal HPTotal HJTotal DiscTotal HJnet"); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['hp1'] += $hp ; + $ttJumlah['hj1'] += $hj; + $ttJumlah['disc1'] += $disc; + $ttJumlah['hjnet1'] += $hjnet; + print("$keljns".number_format($hp,0,',','.')."".number_format($hj,0,',','.')."".number_format($disc,0,',','.')."".number_format($hjnet,0,',','.').""); + } + print("".number_format($ttJumlah['hp1'],0,',','.')."".number_format($ttJumlah['hj1'],0,',','.')."".number_format($ttJumlah['disc1'],0,',','.')."".number_format($ttJumlah['hjnet1'],0,',','.').""); + print("
"); + print("
"); + print("
"); + }else{ + echo "Belum ada penjualan tunai untuk tanggal tersebut!"; + echo "
"; + } + } +/*------------------------------------------------------------------------------------ retur tunai -----------------------------------------------------*/ + $query2="select s.nama_strip,sum(hp) totHP,sum(hj) totHJ,sum(disc) totDisc,sum(hjnet) totHJnet + from (select b.kode_strip lini,sum(d.harga_jual * d.jumlah) hj,sum(d.harga_jual * d.jumlah * d.diskon / 100) disc,sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) hjnet,sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_retur d,m_nota_retur m,m_nota_tunai mt, barang b + where d.no_nota = m.no_nota + and d.no_nota_tunai = mt.no_nota + and d.kd_barang = b.kode_barang + and d.harga_pokok IS NOT NULL + and (m.status_nota != 'B') + and mt.status_bayar = 'T' + and date(m.tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip + ) vretur, strip s + where s.kd_strip = lini + group by s.kd_strip"; + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$keljns2,$hp2,$hj2,$disc2,$hjnet2); + $ttJumlah2 = array(); + $ttJumlah2['hp2'] = 0; + $ttJumlah2['hj2'] = 0; + $ttJumlah2['disc2'] = 0; + $ttJumlah2['hjnet2'] = 0; + + print("
"); + print("

Retur Tunai



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt2)){ + $ttJumlah2['hp2'] += $hp2 ; + $ttJumlah2['hj2'] += $hj2; + $ttJumlah2['disc2'] += $disc2; + $ttJumlah2['hjnet2'] += $hjnet2; + print(""); + } + print(""); + print(""); + print("
KategoriTotal HPTotal HJTotal DiscTotal HJnet
$keljns2".number_format($hp2,0,',','.')."".number_format($hj2,0,',','.')."".number_format($disc2,0,',','.')."".number_format($hjnet2,0,',','.')."
".number_format($ttJumlah2['hp2'],0,',','.')."".number_format($ttJumlah2['hj2'],0,',','.')."".number_format($ttJumlah2['disc2'],0,',','.')."".number_format($ttJumlah2['hjnet2'],0,',','.')."
NETT TUNAI".number_format($ttJumlah['hp1']-$ttJumlah2['hp2'],0,',','.')."".number_format($ttJumlah['hj1']-$ttJumlah2['hj2'],0,',','.')."".number_format($ttJumlah['disc1']-$ttJumlah2['disc2'],0,',','.')."".number_format($ttJumlah['hjnet1']-$ttJumlah2['hjnet2'],0,',','.')."

"); + print("
"); + print("
"); + }else{ + echo "Tidak ada retur tunai untuk tanggal tersebut!"; + echo "
"; + } + } +$nett_tunai = $ttJumlah['hjnet1']-$ttJumlah2['hjnet2']; +/*------------------------------------------------------------------------------------ kartu -----------------------------------------------------*/ + $query3="select s.nama_strip,sum(hp) totHP,sum(hj) totHJ,sum(disc) totDisc,sum(hjnet) totHJnet + from (select b.kode_strip lini,sum(d.harga_jual * d.jumlah) hj,sum(d.harga_jual * d.jumlah * d.diskon / 100) disc,sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) hjnet, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m, barang b + where d.no_nota = m.no_nota + and d.kd_barang = b.kode_barang + and d.harga_pokok IS NOT NULL + and m.status_nota = 'S' + and m.status_bayar = 'K' + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip + ) vtunai, strip s + where s.kd_strip = lini + group by s.kd_strip"; + + if($stmt3 = mysqli_prepare($conn,$query3)){ + mysqli_stmt_execute($stmt3); + mysqli_stmt_store_result($stmt3); + $cek3 = mysqli_stmt_num_rows($stmt3); + if($cek3 > 0){ + mysqli_stmt_bind_result($stmt3,$keljns3,$hp3,$hj3,$disc3,$hjnet3); + $ttJumlah3 = array(); + $ttJumlah3['hp3'] = 0; + $ttJumlah3['hj3'] = 0; + $ttJumlah3['disc3'] = 0; + $ttJumlah3['hjnet3'] = 0; + + print("
"); + print("

Transaksi Kartu



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt3)){ + $ttJumlah3['hp3'] += $hp3 ; + $ttJumlah3['hj3'] += $hj3; + $ttJumlah3['disc3'] += $disc3; + $ttJumlah3['hjnet3'] += $hjnet3; + print(""); + } + print(""); + print("
KategoriTotal HPTotal HJTotal DiscTotal HJnet
$keljns3".number_format($hp3,0,',','.')."".number_format($hj3,0,',','.')."".number_format($disc3,0,',','.')."".number_format($hjnet3,0,',','.')."
".number_format($ttJumlah3['hp3'],0,',','.')."".number_format($ttJumlah3['hj3'],0,',','.')."".number_format($ttJumlah3['disc3'],0,',','.')."".number_format($ttJumlah3['hjnet3'],0,',','.')."

"); + print("
"); + print("
"); + }else{ + echo "Belum ada transaksi kartu untuk tanggal tersebut!"; + echo "
"; + } + } +/*------------------------------------------------------------------------------------ retur kartu -----------------------------------------------------*/ + $query4="select s.nama_strip,sum(hp) totHP,sum(hj) totHJ,sum(disc) totDisc,sum(hjnet) totHJnet + from (select b.kode_strip lini,sum(d.harga_jual * d.jumlah) hj,sum(d.harga_jual * d.jumlah * d.diskon / 100) disc,sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) hjnet,sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_retur d,m_nota_retur m,m_nota_tunai mt, barang b + where d.no_nota = m.no_nota + and d.no_nota_tunai = mt.no_nota + and d.kd_barang = b.kode_barang + and d.harga_pokok IS NOT NULL + and (m.status_nota != 'B') + and mt.status_bayar = 'K' + and date(m.tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip + ) vretur, strip s + where s.kd_strip = lini + group by s.kd_strip"; + + if($stmt4 = mysqli_prepare($conn,$query4)){ + mysqli_stmt_execute($stmt4); + mysqli_stmt_store_result($stmt4); + $cek4 = mysqli_stmt_num_rows($stmt4); + if($cek4 > 0){ + mysqli_stmt_bind_result($stmt4,$keljns4,$hp4,$hj4,$disc4,$hjnet4); + $ttJumlah4 = array(); + $ttJumlah4['hp4'] = 0; + $ttJumlah4['hj4'] = 0; + $ttJumlah4['disc4'] = 0; + $ttJumlah4['hjnet4'] = 0; + + print("
"); + print("

Retur Kartu



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt4)){ + $ttJumlah4['hp4'] += $hp4 ; + $ttJumlah4['hj4'] += $hj4; + $ttJumlah4['disc4'] += $disc4; + $ttJumlah4['hjnet4'] += $hjnet4; + print(""); + } + print(""); + print(""); + print("
KategoriTotal HPTotal HJTotal DiscTotal HJnet
$keljns4".number_format($hp4,0,',','.')."".number_format($hj4,0,',','.')."".number_format($disc4,0,',','.')."".number_format($hjnet4,0,',','.')."
".number_format($ttJumlah4['hp4'],0,',','.')."".number_format($ttJumlah4['hj4'],0,',','.')."".number_format($ttJumlah4['disc4'],0,',','.')."".number_format($ttJumlah4['hjnet4'],0,',','.')."
NETT KARTU".number_format($ttJumlah3['hp3']-$ttJumlah4['hp4'],0,',','.')."".number_format($ttJumlah3['hj3']-$ttJumlah4['hj4'],0,',','.')."".number_format($ttJumlah3['disc3']-$ttJumlah4['disc4'],0,',','.')."".number_format($ttJumlah3['hjnet3']-$ttJumlah4['hjnet4'],0,',','.')."

"); + print("
"); + print("
"); + }else{ + echo "Tidak ada retur kartu untuk tanggal tersebut!"; + echo "
"; + } + } + +$nett_kartu = $ttJumlah3['hjnet3']-$ttJumlah4['hjnet4']; + +/*------------------------------------------------------------------------------------ bon -----------------------------------------------------*/ + $query5="select s.nama_strip,sum(hp) totHP,sum(hj) totHJ,sum(disc) totDisc,sum(hjnet) totHJnet + from (select b.kode_strip lini,sum(d.hrg_satuan * d.jumlah) hj,sum(d.hrg_satuan * d.jumlah * d.diskon / 100) disc, + sum((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) hjnet, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_bon d,m_bon m, barang b + where d.no_bon = m.no_bon + and d.kd_brg = b.kode_barang + and d.harga_pokok IS NOT NULL + and date(tgl_bon) between '$startDate' and '$endDate' + group by b.kode_strip + )vretur, strip s + where s.kd_strip = lini + group by s.kd_strip"; + + if($stmt5 = mysqli_prepare($conn,$query5)){ + mysqli_stmt_execute($stmt5); + mysqli_stmt_store_result($stmt5); + $cek5 = mysqli_stmt_num_rows($stmt5); + if($cek5 > 0){ + mysqli_stmt_bind_result($stmt5,$keljns5,$hp5,$hj5,$disc5,$hjnet5); + $ttJumlah5 = array(); + $ttJumlah5['hp5'] = 0; + $ttJumlah5['hj5'] = 0; + $ttJumlah5['disc5'] = 0; + $ttJumlah5['hjnet5'] = 0; + + print("
"); + print("

Transaksi Bon



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt5)){ + $ttJumlah5['hp5'] += $hp5 ; + $ttJumlah5['hj5'] += $hj5; + $ttJumlah5['disc5'] += $disc5; + $ttJumlah5['hjnet5'] += $hjnet5; + print(""); + } + print(""); + print("
KategoriTotal HPTotal HJTotal DiscTotal HJnet
$keljns5".number_format($hp5,0,',','.')."".number_format($hj5,0,',','.')."".number_format($disc5,0,',','.')."".number_format($hjnet5,0,',','.')."
".number_format($ttJumlah5['hp5'],0,',','.')."".number_format($ttJumlah5['hj5'],0,',','.')."".number_format($ttJumlah5['disc5'],0,',','.')."".number_format($ttJumlah5['hjnet5'],0,',','.')."

"); + print("
"); + print("
"); + }else{ + echo "Belum ada transaksi bon untuk tanggal tersebut!"; + echo "
"; + } + } +/*------------------------------------------------------------------------------------ retur kartu -----------------------------------------------------*/ + $query6="select s.nama_strip,sum(hp) totHP,sum(hj) totHJ,sum(disc) totDisc,sum(hjnet) totHJnet + from (select b.kode_strip lini,sum(d.harga_jual * d.jumlah) hj,sum(d.harga_jual * d.jumlah * d.diskon / 100) disc,sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) hjnet,sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_retur d,m_nota_retur m,m_bon mt, barang b + where d.no_nota = m.no_nota + and d.kd_barang = b.kode_barang + and d.no_nota_tunai = mt.no_bon + and d.harga_pokok IS NOT NULL + and (m.status_nota != 'T') + and date(m.tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip + ) vretur, strip s + where s.kd_strip = lini + group by s.kd_strip"; + + if($stmt6 = mysqli_prepare($conn,$query6)){ + mysqli_stmt_execute($stmt6); + mysqli_stmt_store_result($stmt6); + $cek6 = mysqli_stmt_num_rows($stmt6); + if($cek6 > 0){ + mysqli_stmt_bind_result($stmt6,$keljns6,$hp6,$hj6,$disc6,$hjnet6); + $ttJumlah6 = array(); + $ttJumlah6['hp6'] = 0; + $ttJumlah6['hj6'] = 0; + $ttJumlah6['disc6'] = 0; + $ttJumlah6['hjnet6'] = 0; + + print("
"); + print("

Retur Bon



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt6)){ + $ttJumlah6['hp6'] += $hp6 ; + $ttJumlah6['hj6'] += $hj6; + $ttJumlah6['disc6'] += $disc6; + $ttJumlah6['hjnet6'] += $hjnet6; + print(""); + } + print(""); + print(""); + print("
KategoriTotal HPTotal HJTotal DiscTotal HJnet
$keljns6".number_format($hp6,0,',','.')."".number_format($hj6,0,',','.')."".number_format($disc6,0,',','.')."".number_format($hjnet6,0,',','.')."
".number_format($ttJumlah6['hp6'],0,',','.')."".number_format($ttJumlah6['hj6'],0,',','.')."".number_format($ttJumlah6['disc6'],0,',','.')."".number_format($ttJumlah6['hjnet6'],0,',','.')."
NETT BON".number_format($ttJumlah5['hp5']-$ttJumlah6['hp6'],0,',','.')."".number_format($ttJumlah5['hj5']-$ttJumlah6['hj6'],0,',','.')."".number_format($ttJumlah5['disc5']-$ttJumlah6['disc6'],0,',','.')."".number_format($ttJumlah5['hjnet5']-$ttJumlah6['hjnet6'],0,',','.')."

"); + print("
"); + print("
"); + }else{ + echo "Tidak ada retur bon untuk tanggal tersebut!"; + echo "
"; + } + } + +$nett_bon = $ttJumlah5['hjnet5']-$ttJumlah6['hjnet6']; + + /*----------------------------------------Rekap TITIPAN */ + $query7 = "select sum(t.bayar_bon) + from bayar_bon t + where date(t.tgl_byr) between '$startDate' AND '$endDate'"; + if($stmt7 = mysqli_prepare($conn,$query7)){ + mysqli_stmt_execute($stmt7); + mysqli_stmt_store_result($stmt7); + $cek7 = mysqli_stmt_num_rows($stmt7); + if($cek7 > 0){ + mysqli_stmt_bind_result($stmt7,$total); + $ttJumlah7 = array(); + $ttJumlah7['rp7'] = 0; + + while(mysqli_stmt_fetch($stmt7)){ + $ttJumlah7['rp7'] += $total; + } + }else{ + echo "Belum ada data titipan untuk tanggal tersebut!"; + echo "
"; + } + } + + /*----------------------------------------Rekap Komisi */ + $query8 = "select sum(k.jumlah) + from komisi k + where date(k.tgl_ambil) between '$startDate' AND '$endDate'"; + if($stmt8 = mysqli_prepare($conn,$query8)){ + mysqli_stmt_execute($stmt8); + mysqli_stmt_store_result($stmt8); + $cek8 = mysqli_stmt_num_rows($stmt8); + if($cek8 > 0){ + mysqli_stmt_bind_result($stmt8,$total1); + $ttJumlah8 = array(); + $ttJumlah8['rp8'] = 0; + + while(mysqli_stmt_fetch($stmt8)){ + $ttJumlah8['rp8'] += $total1; + } + }else{ + echo "Belum ada data komisi untuk tanggal tersebut!"; + echo "
"; + } + } + print("
"); + print(""); + print(""); + print(" + + + + "); + + $nett_total_tunai = ceil($nett_tunai) + ceil($nett_kartu); + $nett_total_omset = ceil($nett_tunai) + ceil($nett_kartu) + ceil($nett_bon); + $andil_tunai = ($nett_total_tunai/$nett_total_omset*100); + + $qry_createtmp = "CREATE TABLE IF NOT EXISTS `tmp_lapdetailjual` ( + `total_tunai` bigint(20) NOT NULL, + `total_omset` bigint(20) NOT NULL, + `andil` decimal(10,2) NOT NULL + ) ENGINE=MyISAM DEFAULT CHARSET=latin1;"; + runQuery($qry_createtmp); + $qry_ins = "INSERT INTO `tmp_lapdetailjual` ( + `total_tunai`, + `total_omset`, + `andil` + ) VALUE($nett_total_tunai,$nett_total_omset,$andil_tunai)"; + runQuery($qry_ins); + + print(""); + print(""); + print("
Total HPTotal HJTotal DiscTotal HJnet
GRAND TOTAL".number_format(($ttJumlah['hp1']-$ttJumlah2['hp2'])+($ttJumlah3['hp3']-$ttJumlah4['hp4'])+($ttJumlah5['hp5']-$ttJumlah6['hp6']),0,',','.')."".number_format(($ttJumlah['hj1']-$ttJumlah2['hj2'])+($ttJumlah3['hj3']-$ttJumlah4['hj4'])+($ttJumlah5['hj5']-$ttJumlah6['hj6']),0,',','.')."".number_format(($ttJumlah['disc1']-$ttJumlah2['disc2'])+($ttJumlah3['disc3']-$ttJumlah4['disc4'])+($ttJumlah5['disc5']-$ttJumlah6['disc6']),0,',','.')."".number_format(($ttJumlah['hjnet1']-$ttJumlah2['hjnet2'])+($ttJumlah3['hjnet3']-$ttJumlah4['hjnet4'])+($ttJumlah5['hjnet5']-$ttJumlah6['hjnet6']),0,',','.')."
Total Titipan".number_format($ttJumlah7['rp7'],0,',','.')."
Total Komisi".number_format($ttJumlah8['rp8'],0,',','.')."

"); + print("
"); + print("
"); + + } +?> diff --git a/old-source/LaporanJual/lapdisp.php b/old-source/LaporanJual/lapdisp.php new file mode 100644 index 0000000..8e5b203 --- /dev/null +++ b/old-source/LaporanJual/lapdisp.php @@ -0,0 +1,139 @@ +"; + echo "div#divprint{width:1024px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:950px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:50px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = $_POST['kdsupp']; + $endDate = $_POST['endDate']; + + + if(bukaKoneksi()){ + global $conn; + IF ($startDate != '' && $endDate != ''){ + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ, m.status + FROM barang b,no_barang n, d_pembelian d, m_pembelian m + WHERE n.stok > 0 + and b.id_gabungan = n.id_gabungan + and m.no_faktur = d.no_faktur + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_supplier = '$startDate' + and b.kode_strip = '$endDate' + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + }elseif ($startDate == '' && $endDate != ''){ + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ, m.status + FROM barang b,no_barang n, d_pembelian d, m_pembelian m + WHERE n.stok > 0 + and b.id_gabungan = n.id_gabungan + and m.no_faktur = d.no_faktur + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_strip = '$endDate' + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + }else { + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ, m.status + FROM barang b,no_barang n, d_pembelian d, m_pembelian m + WHERE n.stok > 0 + and b.id_gabungan = n.id_gabungan + and m.no_faktur = d.no_faktur + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_supplier = '$startDate' + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + + } + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tahun,$bln,$strip,$kdasli,$nofaktur,$kdbrg,$nmbrg,$nomor,$akhir,$pokok,$hp,$jual,$hj,$status); + + $lebar_label = 200; + $tinggi_label = 115; + $label_per_baris = 3; + $baris_per_halaman = 7; + + $total = $cek; + $baris=1; $kolom=1; + + for ($i = 1; $i <= $total; $i++) { + + $r = mysqli_stmt_fetch($stmt); + $clear = ""; + $barcode = strtoupper($kdbrg); + // cek posisi saat ini + if ($kolom > $label_per_baris) { + $kolom = 1; + $baris++; + $clear = " clear:left; "; + }; + if ($baris > $baris_per_halaman) { + $baris = 1; + echo '

'; + }; + + $namaBarang = $nmbrg; + // cetak label + echo "\n + +

+

+ +

+

+ ".strtoupper($namaBarang)." +

+

+ ".number_format($jual,0,',','.')."

+
+ "; + + $kolom++; + } // end for + }else{ + echo "Data tidak ada!"; + } + } + } +?> diff --git a/old-source/LaporanJual/lapjualdlmpdk.php b/old-source/LaporanJual/lapjualdlmpdk.php new file mode 100644 index 0000000..465c3e3 --- /dev/null +++ b/old-source/LaporanJual/lapjualdlmpdk.php @@ -0,0 +1,208 @@ +"; + echo "div#divprint{width:900px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:850px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + + if(bukaKoneksi()){ + global $conn; + $query = "select s.kel_jns,s.nama_strip,dlm,ked_produk,sum(juml) vol,sum(tot) totHJ,sum(hp) totHP + from ( + select b.kode_strip lini,b.ked_produk dlm,k.ked_produk,sum(jumlah) juml, + sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m, kedalaman_produk k, barang b + where d.no_nota = m.no_nota + and d.kd_barang = b.kode_barang + and (b.kode_strip = k.kode_strip and b.ked_produk = k.kode_ked_produk) + and d.harga_pokok IS NOT NULL + and m.status_nota = 'S' + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip,b.ked_produk + UNION ALL + select b.kode_strip lini,b.ked_produk dlm,k.ked_produk,(-1*sum(jumlah)) juml, + (-1*sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100))) tot, + (-1*sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp + from d_nota_retur d,m_nota_retur m, kedalaman_produk k, barang b + where d.no_nota = m.no_nota + and d.kd_barang = b.kode_barang + and (b.kode_strip = k.kode_strip and b.ked_produk = k.kode_ked_produk) + and d.harga_pokok IS NOT NULL + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip,b.ked_produk + UNION ALL + select b.kode_strip lini,b.ked_produk dlm,k.ked_produk,sum(jumlah) juml, + sum((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_bon d,m_bon m, kedalaman_produk k, barang b + where d.no_bon = m.no_bon + and d.kd_brg = b.kode_barang + and (b.kode_strip = k.kode_strip and b.ked_produk = k.kode_ked_produk) + and d.harga_pokok IS NOT NULL + and date(tgl_bon) between '$startDate' and '$endDate' + group by b.kode_strip,b.ked_produk + ) vdlmpdk,strip s + where s.kd_strip = lini + group by s.kd_strip,dlm"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kelJns,$strip,$kdSuppl,$nmSuppl,$jmlBeli,$rpBeli,$hrgPokok); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['rp'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['rp'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['rp'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['rp'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + + print("
"); + print("

Laporan Penjualan Per Sub Group Product



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PADA TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $str = array(); + $jmlB = array(); + $rpB = array(); + $HP = array(); + $kdSupplier = array(); + $nmSupplier = array(); + + while(mysqli_stmt_fetch($stmt)){ + if($jmlRetur == ''){ + $jmlRetur = 0; + } + if($rpRetur == ''){ + $rpRetur = 0; + } + if($kelJns == "P"){ + $kelJns = "Pria"; + $ttJmlBeli['pria']['jml'] += $jmlBeli; + $ttJmlBeli['pria']['rp'] += $rpBeli; + $ttJmlBeli['pria']['hp'] += $hrgPokok; + $str[$pria]['pria'] = $strip; + $jmlB[$pria]['pria'] = $jmlBeli; + $rpB[$pria]['pria'] = $rpBeli; + $HP[$pria]['pria'] = $hrgPokok; + $kdSupplier[$pria]['pria'] = $kdSuppl; + $nmSupplier[$pria]['pria'] = $nmSuppl; + $pria++; + }elseif($kelJns == "W"){ + $kelJns = "Wanita"; + $ttJmlBeli['wanita']['jml'] += $jmlBeli; + $ttJmlBeli['wanita']['rp'] += $rpBeli; + $ttJmlBeli['wanita']['hp'] += $hrgPokok; + $str[$wanita]['wanita'] = $strip; + $jmlB[$wanita]['wanita'] = $jmlBeli; + $rpB[$wanita]['wanita'] = $rpBeli; + $HP[$wanita]['wanita'] = $hrgPokok; + $kdSupplier[$wanita]['wanita'] = $kdSuppl; + $nmSupplier[$wanita]['wanita'] = $nmSuppl; + $wanita++; + }elseif($kelJns == "A"){ + $kelJns = "Anak"; + $ttJmlBeli['anak']['jml'] += $jmlBeli; + $ttJmlBeli['anak']['rp'] += $rpBeli; + $ttJmlBeli['anak']['hp'] += $hrgPokok; + $str[$anak]['anak'] = $strip; + $jmlB[$anak]['anak'] = $jmlBeli; + $rpB[$anak]['anak'] = $rpBeli; + $HP[$anak]['anak'] = $hrgPokok; + $kdSupplier[$anak]['anak'] = $kdSuppl; + $nmSupplier[$anak]['anak'] = $nmSuppl; + $anak++; + }else{ + $kelJns = "Sepatu"; + $ttJmlBeli['sepatu']['jml'] += $jmlBeli; + $ttJmlBeli['sepatu']['rp'] += $rpBeli; + $ttJmlBeli['sepatu']['hp'] += $hrgPokok; + $str[$sepatu]['sepatu'] = $strip; + $jmlB[$sepatu]['sepatu'] = $jmlBeli; + $rpB[$sepatu]['sepatu'] = $rpBeli; + $HP[$sepatu]['sepatu'] = $hrgPokok; + $kdSupplier[$sepatu]['sepatu'] = $kdSuppl; + $nmSupplier[$sepatu]['sepatu'] = $nmSuppl; + $sepatu++; + } + + } + print(""); + print(""); + print("
"); + + +/* SEPATU -------------------------------------------------------------------------*/ + $jmlkatsepatu = $ttJmlBeli['sepatu']['jml']; + $rpkatsepatu = $ttJmlBeli['sepatu']['rp']; + $hpkatsepatu = $ttJmlBeli['sepatu']['hp']; + + if($ttJmlBeli['sepatu']['jml']!=0){ + print("
"); + for($i=0;$i<$sepatu;$i++){ + if ($str[$i-1]['sepatu']==$str[$i]['sepatu']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlahrugi4 = 0; + $temphprugi4 = 0; + $temprprugi4 = 0; + } + $tempjumlahrugi4 += $jmlB[$i]['sepatu']; + $temphprugi4 += $HP[$i]['sepatu']; + $temprprugi4 += $rpB[$i]['sepatu']; + } + print(""); + } + + $ttjml = $jmlkatpria + $jmlkatwanita + $jmlkatanak + $jmlkatsepatu; + $ttrp = $rpkatpria + $rpkatwanita + $rpkatanak + $rpkatsepatu; + $tthp = $hpkatpria + $hpkatwanita + $hpkatanak + $hpkatsepatu; + + print(" + + + "); + + print("
Lini ProdukKode Sub GroupSub Group ProductJumlah JualTotal JualTotal HP Jual
".$str[$i]['sepatu'].".".$kdSupplier[$i]['sepatu']."".$nmSupplier[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($rpB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlahrugi4, 0, ",", ".")."".number_format($temprprugi4, 0, ",", ".")."".number_format($temphprugi4, 0, ",", ".")."
".$str[$i]['sepatu'].".".$kdSupplier[$i]['sepatu']."".$nmSupplier[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($rpB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlahrugi4, 0, ",", ".")."".number_format($temprprugi4, 0, ",", ".")."".number_format($temphprugi4, 0, ",", ".")."
T O T A L : ".number_format($ttjml, 0, ",", ".")."".number_format($ttrp, 0, ",", ".")."".number_format($tthp, 0, ",", ".")."

"); + }else{ + echo "Belum ada data pembelian untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanJual/lapjualgrouppersupp.php b/old-source/LaporanJual/lapjualgrouppersupp.php new file mode 100644 index 0000000..d677c99 --- /dev/null +++ b/old-source/LaporanJual/lapjualgrouppersupp.php @@ -0,0 +1,251 @@ +"; + echo "table.tbl {width:950px;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:100px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate2']); + $endDate = decTgl($_POST['endDate2']); + + + if(bukaKoneksi()){ + global $conn; +// /*----------------------------------------Penjualan grouping per konveksi per supplier*/ +// $query = "select CASE s.kel_jns when 'A' then 'Konveksi' +// when 'P' then 'Konveksi' +// when 'W' then 'Konveksi' +// END kategori,kode_supplier,nama_supplier,sum(juml) vol,sum(tot) totHJ,sum(hp) totHP +// from ( +// select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, +// sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) tot, +// sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp +// from d_nota_tunai d,m_nota_tunai m, barang b,supplier u +// where d.no_nota = m.no_nota +// AND d.kd_barang = b.kode_barang +// AND b.kode_supplier = u.kd_supplier +// and d.harga_pokok IS NOT NULL +// and m.status_nota = 'S' +// and date(tgl_nota) between '$startDate' AND '$endDate' +// group by b.kode_strip,b.kode_supplier +// UNION ALL +// select b.kode_strip lini,b.kode_supplier, u.nama_supplier,(-1*sum(jumlah)) juml, +// (-1*sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100))) tot, +// (-1*sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp +// from d_nota_retur d,m_nota_retur m, barang b,supplier u +// where d.no_nota = m.no_nota +// AND d.kd_barang = b.kode_barang +// AND b.kode_supplier = u.kd_supplier +// and d.harga_pokok IS NOT NULL +// and date(tgl_nota) between '$startDate' AND '$endDate' +// group by b.kode_strip,b.kode_supplier +// UNION ALL +// select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, +// sum((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) tot, +// sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp +// from d_bon d,m_bon m, barang b,supplier u +// where d.no_bon = m.no_bon +// AND d.kd_brg = b.kode_barang +// AND b.kode_supplier = u.kd_supplier +// and d.harga_pokok IS NOT NULL +// and date(tgl_bon) between '$startDate' AND '$endDate' +// group by b.kode_strip,b.kode_supplier +// ) vlini,strip s +// where s.kd_strip = lini +// AND s.kel_jns != 'S' +// group by kode_supplier"; +// if($stmt = mysqli_prepare($conn,$query)){ +// mysqli_stmt_execute($stmt); +// mysqli_stmt_store_result($stmt); +// $cek = mysqli_stmt_num_rows($stmt); +// if($cek > 0){ +// mysqli_stmt_bind_result($stmt,$kat,$kdsupp,$supp,$jml,$hj,$hp); +// +// print("
"); +// print("

Rekap Penjualan Kelp.Kategori Konveksi Per Supplier



"); +// print("
TOKO ".$_SESSION['namatoko']."
"); +// print("TANGGAL MASUK : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); +// print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."


"); +// print(""); +// print(""); +// +// $ttHJ = 0; +// $ttHP = 0; +// $profit = 0; +// while(mysqli_stmt_fetch($stmt)){ +// $ttHJ += $hj; +// $ttHP += $hp; +// $profit = ($hj-$hp)/$hj*100; +// print(" +// "); +// } +// print(""); +// print("
Kelp.KategoriKode SupplierNama SupplierJumlHarga JualHarga PokokProfit[%]
$kat.$kdsupp$supp$jml".number_format($hj,0,',','.')."".number_format($hp,0,',','.')."".number_format($profit,2,',','.')."
T O T A L".number_format($ttHJ,0,',','.')."".number_format($ttHP,0,',','.')."

"); +// print("
"); +// }else{ +// echo "data tdk ada!"; +// echo "
"; +// } +// } +// /*----------------------------------------Penjualan grouping per sepatu per supplier*/ +// $query = "select CASE s.kel_jns when 'S' then 'Sepatu' +// END kategori,kode_supplier,nama_supplier,sum(juml) vol,sum(tot) totHJ,sum(hp) totHP +// from ( +// select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, +// sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) tot, +// sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp +// from d_nota_tunai d,m_nota_tunai m, barang b,supplier u +// where d.no_nota = m.no_nota +// AND d.kd_barang = b.kode_barang +// AND b.kode_supplier = u.kd_supplier +// and d.harga_pokok IS NOT NULL +// and m.status_nota = 'S' +// and date(tgl_nota) between '$startDate' AND '$endDate' +// group by b.kode_strip,b.kode_supplier +// UNION ALL +// select b.kode_strip lini,b.kode_supplier, u.nama_supplier,(-1*sum(jumlah)) juml, +// (-1*sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100))) tot, +// (-1*sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp +// from d_nota_retur d,m_nota_retur m, barang b,supplier u +// where d.no_nota = m.no_nota +// AND d.kd_barang = b.kode_barang +// AND b.kode_supplier = u.kd_supplier +// and d.harga_pokok IS NOT NULL +// and date(tgl_nota) between '$startDate' AND '$endDate' +// group by b.kode_strip,b.kode_supplier +// UNION ALL +// select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, +// sum((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) tot, +// sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp +// from d_bon d,m_bon m, barang b,supplier u +// where d.no_bon = m.no_bon +// AND d.kd_brg = b.kode_barang +// AND b.kode_supplier = u.kd_supplier +// and d.harga_pokok IS NOT NULL +// and date(tgl_bon) between '$startDate' AND '$endDate' +// group by b.kode_strip,b.kode_supplier +// ) vlini,strip s +// where s.kd_strip = lini +// AND s.kel_jns = 'S' +// group by kode_supplier"; +// if($stmt = mysqli_prepare($conn,$query)){ +// mysqli_stmt_execute($stmt); +// mysqli_stmt_store_result($stmt); +// $cek = mysqli_stmt_num_rows($stmt); +// if($cek > 0){ +// mysqli_stmt_bind_result($stmt,$kat,$kdsupp,$supp,$jml,$hj,$hp); +// +// print("
"); +// print("

Rekap Penjualan Kelp.Kategori Sepatu Per Supplier



"); +// print("
TOKO ".$_SESSION['namatoko']."
"); +// print("TANGGAL MASUK : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); +// print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."


"); +// print(""); +// print(""); +// +// $ttHJ = 0; +// $ttHP = 0; +// $profit = 0; +// while(mysqli_stmt_fetch($stmt)){ +// $ttHJ += $hj; +// $ttHP += $hp; +// $profit = ($hj-$hp)/$hj*100; +// print(" +// "); +// } +// print(""); +// print("
Kelp.KategoriKode SupplierNama SupplierJumlHarga JualHarga PokokProfit[%]
$kat.$kdsupp$supp$jml".number_format($hj,0,',','.')."".number_format($hp,0,',','.')."".number_format($profit,2,',','.')."
T O T A L".number_format($ttHJ,0,',','.')."".number_format($ttHP,0,',','.')."

"); +// print("
"); +// }else{ +// echo "data tdk ada!"; +// echo "
"; +// } +// } + /*----------------------------------------Penjualan grouping per supplier*/ + $query = "select kode_supplier,nama_supplier,sum(juml) vol,sum(tot) totHJ,sum(hp) totHP + from ( + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, + sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m, barang b,supplier u + where d.no_nota = m.no_nota + AND d.kd_barang = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and d.harga_pokok IS NOT NULL + and m.status_nota = 'S' + and date(tgl_nota) between '$startDate' AND '$endDate' + group by b.kode_strip,b.kode_supplier + UNION ALL + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,(-1*sum(jumlah)) juml, + (-1*sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100))) tot, + (-1*sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp + from d_nota_retur d,m_nota_retur m, barang b,supplier u + where d.no_nota = m.no_nota + AND d.kd_barang = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and d.harga_pokok IS NOT NULL + and date(tgl_nota) between '$startDate' AND '$endDate' + group by b.kode_strip,b.kode_supplier + UNION ALL + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, + sum((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_bon d,m_bon m, barang b,supplier u + where d.no_bon = m.no_bon + AND d.kd_brg = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and d.harga_pokok IS NOT NULL + and date(tgl_bon) between '$startDate' AND '$endDate' + group by b.kode_strip,b.kode_supplier + ) vlini,strip s + where s.kd_strip = lini + group by kode_supplier"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdsupp,$supp,$jml,$hj,$hp); + + print("
"); + print("

Rekap Penjualan Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("Pada Tanggal : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."


"); + print(""); + print(""); + + $ttHJ = 0; + $ttHP = 0; + $profit = 0; + while(mysqli_stmt_fetch($stmt)){ + $ttHJ += $hj; + $ttHP += $hp; + $profit = ($hj-$hp)/$hj*100; + print(" + "); + } + print(""); + print("
Kode SupplierNama SupplierJumlHarga JualHarga PokokProfit[%]
.$kdsupp$supp$jml".number_format($hj,0,',','.')."".number_format($hp,0,',','.')."".number_format($profit,2,',','.')."
T O T A L".number_format($ttHJ,0,',','.')."".number_format($ttHP,0,',','.')."

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + print("

"); + } + +?> diff --git a/old-source/LaporanJual/lapjualperkat.php b/old-source/LaporanJual/lapjualperkat.php new file mode 100644 index 0000000..71af21d --- /dev/null +++ b/old-source/LaporanJual/lapjualperkat.php @@ -0,0 +1,275 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:700px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $tanggal = encTgl($startDate); + $bulan = substr($tanggal,3,2); + $tmpbulan = left($bulan,1); + if($tmpbulan == '0'){ + $bln = right($bulan,1); + }else{ + $bln = $bulan; + } + $thn = substr($tanggal,6,4); + + if(bukaKoneksi()){ + global $conn; + $qry_tmp = "CREATE TABLE tmp_lapjualperkat AS + select s.kel_jns, s.nama_strip, k.ked_produk, sum(juml) vol, sum(hjbruto) HJbruto, sum(disc) Disc, sum(tot) totHJ,sum(hp) totHP,(sum(tot)-sum(hp))/sum(tot)*100 nettprofit + from ( + select b.kode_strip lini,sum(jumlah) juml, + sum(d.harga_jual * d.jumlah) hjbruto, + sum(d.harga_jual * d.jumlah * d.diskon / 100) disc, + sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m, barang b + where d.no_nota = m.no_nota + AND d.kd_barang = b.kode_barang + and d.harga_pokok IS NOT NULL + and m.status_nota = 'S' + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip + UNION ALL + select b.kode_strip lini,sum(jumlah) juml, + sum(d.hrg_satuan * d.jumlah) hjbruto, + sum(d.hrg_satuan * d.jumlah * d.diskon / 100) disc, + sum((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_bon d,m_bon m,barang b + where d.no_bon = m.no_bon + and d.kd_brg = b.kode_barang + and d.harga_pokok IS NOT NULL + and date(tgl_bon) between '$startDate' and '$endDate' + group by b.kode_strip + UNION ALL + select b.kode_strip lini,(-1*sum(jumlah)) juml, + (-1*sum(d.harga_jual * d.jumlah)) hjbruto, + (-1*sum(d.harga_jual * d.jumlah * d.diskon / 100)) disc, + (-1*sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100))) tot, + (-1*sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp + from d_nota_retur d,m_nota_retur m,barang b + where d.no_nota = m.no_nota + and d.kd_barang = b.kode_barang + and d.harga_pokok IS NOT NULL + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip + ) vlini,strip s + where s.kd_strip = lini + group by kd_strip"; + runQuery($qry_tmp); + + $query = "select s.kel_jns, s.nama_strip, sum(juml) vol, sum(hjbruto) HJbruto, sum(disc) Disc, sum(tot) totHJ,sum(hp) totHP,(sum(tot)-sum(hp))/sum(tot)*100 nettprofit + from ( + select b.kode_strip lini,sum(jumlah) juml, + sum(d.harga_jual * d.jumlah) hjbruto, + sum(d.harga_jual * d.jumlah * d.diskon / 100) disc, + sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m,barang b + where d.no_nota = m.no_nota + and d.kd_barang = b.kode_barang + and d.harga_pokok IS NOT NULL + and m.status_nota = 'S' + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip + UNION ALL + select b.kode_strip lini,sum(jumlah) juml, + sum(d.hrg_satuan * d.jumlah) hjbruto, + sum(d.hrg_satuan * d.jumlah * d.diskon / 100) disc, + sum((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_bon d,m_bon m,barang b + where d.no_bon = m.no_bon + and d.kd_brg = b.kode_barang + and d.harga_pokok IS NOT NULL + and date(tgl_bon) between '$startDate' and '$endDate' + group by b.kode_strip + UNION ALL + select b.kode_strip lini,(-1*sum(jumlah)) juml, + (-1*sum(d.harga_jual * d.jumlah)) hjbruto, + (-1*sum(d.harga_jual * d.jumlah * d.diskon / 100)) disc, + (-1*sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100))) tot, + (-1*sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp + from d_nota_retur d,m_nota_retur m,barang b + where d.no_nota = m.no_nota + and d.kd_barang = b.kode_barang + and d.harga_pokok IS NOT NULL + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip + ) vlini,strip s + where s.kd_strip = lini + group by s.kd_strip "; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kelJns,$strip,$jmlBeli,$HJBrut,$discount,$rpBeli,$hrgPokok,$nettprofit); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['rp'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['pria']['HJbruto'] = 0; + $ttJmlBeli['pria']['disc'] = 0; + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['rp'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['wanita']['HJbruto'] = 0; + $ttJmlBeli['wanita']['disc'] = 0; + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['rp'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['anak']['HJbruto'] = 0; + $ttJmlBeli['anak']['disc'] = 0; + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['rp'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + $ttJmlBeli['sepatu']['HJbruto'] = 0; + $ttJmlBeli['sepatu']['disc'] = 0; + + print("
"); + print("

Laporan Penjualan Per Kelompok Kategori



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PADA TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + ?> + + + "); + print("Lini ProdukVolumeTot HJ BrutoTot DiscTot HJTot HPNettProfit(%)Profit Bruto(%)"); + print("
"); + +// SEPATU ------------------------------------------------------------------------- + $jmlkatsepatu = $ttJmlBeli['sepatu']['jml']; + $rpkatsepatu = $ttJmlBeli['sepatu']['rp']; + $hpkatsepatu = $ttJmlBeli['sepatu']['hp']; + $hjbrutsepatu = $ttJmlBeli['sepatu']['HJbruto']; + $discsepatu = $ttJmlBeli['sepatu']['disc']; + + if($ttJmlBeli['sepatu']['jml']!=0){ + print(""); + for($i=0;$i<$sepatu;$i++){ + print("".$str[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($HJb[$i]['sepatu'], 0, ",", ".")."".number_format($disc[$i]['sepatu'], 0, ",", ".")."".number_format($rpB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."".number_format( (($rpB[$i]['sepatu']-$HP[$i]['sepatu'])/$rpB[$i]['sepatu']*100),2)."".number_format( (($HJb[$i]['sepatu']-$HP[$i]['sepatu'])/$HJb[$i]['sepatu']*100),2).""); + } + print("Sub Total".number_format($jmlkatsepatu, 0, ",", ".")."".number_format($hjbrutsepatu, 0, ",", ".")."".number_format($discsepatu, 0, ",", ".")."".number_format($rpkatsepatu, 0, ",", ".")."".number_format($hpkatsepatu, 0, ",", ".")."".number_format(($rpkatsepatu-$hpkatsepatu)/$rpkatsepatu*100, 2)."".number_format(($hjbrutsepatu-$hpkatsepatu)/$hjbrutsepatu*100, 2).""); + } +//---------------------------------------------------------------------------------- + $ttjml = $jmlkatpria + $jmlkatwanita + $jmlkatanak + $jmlkatsepatu; + $ttrp = $rpkatpria + $rpkatwanita + $rpkatanak + $rpkatsepatu; + $tthp = $hpkatpria + $hpkatwanita + $hpkatanak + $hpkatsepatu; + $ttHJb = $hjbrutpria + $hjbrutwanita + $hjbrutanak + $hjbrutsepatu; + $ttdisc = $discpria + $discwanita + $discanak + $discsepatu; + + + print("T O T A L : + ".number_format($ttjml, 0, ",", ".")." + ".number_format($ttHJb, 0, ",", ".")." + ".number_format($ttdisc, 0, ",", ".")." + ".number_format($ttrp, 0, ",", ".")." + ".number_format($tthp, 0, ",", ".")." + ".number_format(($ttrp-$tthp)/$ttrp*100, 2)." + ".number_format(($ttHJb-$tthp)/$ttHJb*100, 2).""); + + print("
"); + }else{ + echo "Belum ada data penjualan untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanJual/lapjualpersup.php b/old-source/LaporanJual/lapjualpersup.php new file mode 100644 index 0000000..399695e --- /dev/null +++ b/old-source/LaporanJual/lapjualpersup.php @@ -0,0 +1,726 @@ +"; + echo "div#divprint{width:900px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:850px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $kdsupp = $_POST['kdsupp']; + + if(bukaKoneksi()){ + global $conn; + if ($kdsupp!=""){ + $query = "select s.kel_jns,s.nama_strip,kode_supplier,nama_supplier,sum(juml) vol,sum(tot) totHJ,sum(hp) totHP + from ( + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, + sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m, barang b,supplier u + where d.no_nota = m.no_nota + AND d.kd_barang = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and u.kd_supplier = '$kdsupp' + and d.harga_pokok IS NOT NULL + and m.status_nota = 'S' + and d.diskon <> 100 + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + UNION ALL + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,(-1*sum(jumlah)) juml, + (-1*sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100))) tot, + (-1*sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp + from d_nota_retur d,m_nota_retur m, barang b,supplier u + where d.no_nota = m.no_nota + AND d.kd_barang = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and u.kd_supplier = '$kdsupp' + and d.harga_pokok IS NOT NULL + and d.diskon <> 100 + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + UNION ALL + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, + sum((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_bon d,m_bon m, barang b,supplier u + where d.no_bon = m.no_bon + AND d.kd_brg = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and u.kd_supplier = '$kdsupp' + and d.harga_pokok IS NOT NULL + and d.diskon <> 100 + and date(tgl_bon) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + ) vlini,strip s + where s.kd_strip = lini + group by s.kd_strip,kode_supplier + order by s.kd_strip,vol desc"; + }else{ + $query = "select s.kel_jns,s.nama_strip,kode_supplier,nama_supplier,sum(juml) vol,sum(tot) totHJ,sum(hp) totHP + from ( + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, + sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m, barang b,supplier u + where d.no_nota = m.no_nota + AND d.kd_barang = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and d.harga_pokok IS NOT NULL + and m.status_nota = 'S' + and d.diskon <> 100 + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + UNION ALL + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,(-1*sum(jumlah)) juml, + (-1*sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100))) tot, + (-1*sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp + from d_nota_retur d,m_nota_retur m, barang b,supplier u + where d.no_nota = m.no_nota + AND d.kd_barang = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and d.harga_pokok IS NOT NULL + and d.diskon <> 100 + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + UNION ALL + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, + sum((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_bon d,m_bon m, barang b,supplier u + where d.no_bon = m.no_bon + AND d.kd_brg = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and d.harga_pokok IS NOT NULL + and d.diskon <> 100 + and date(tgl_bon) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + ) vlini,strip s + where s.kd_strip = lini + group by s.kd_strip,kode_supplier + order by s.kd_strip,vol desc"; + } + + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kelJns,$strip,$kdSuppl,$nmSuppl,$jmlBeli,$rpBeli,$hrgPokok); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['rp'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['rp'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['rp'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['rp'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + + print("
"); + print("

Laporan Penjualan Per Supplier


"); + print("(sudah dipisah dari penjualan diskon 100%)

"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PADA TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $str = array(); + $jmlB = array(); + $rpB = array(); + $HP = array(); + $kdSupplier = array(); + $nmSupplier = array(); + + while(mysqli_stmt_fetch($stmt)){ + if($jmlRetur == ''){ + $jmlRetur = 0; + } + if($rpRetur == ''){ + $rpRetur = 0; + } + if($kelJns == "P"){ + $kelJns = "Pria"; + $ttJmlBeli['pria']['jml'] += $jmlBeli; + $ttJmlBeli['pria']['rp'] += $rpBeli; + $ttJmlBeli['pria']['hp'] += $hrgPokok; + $str[$pria]['pria'] = $strip; + $jmlB[$pria]['pria'] = $jmlBeli; + $rpB[$pria]['pria'] = $rpBeli; + $HP[$pria]['pria'] = $hrgPokok; + $kdSupplier[$pria]['pria'] = $kdSuppl; + $nmSupplier[$pria]['pria'] = $nmSuppl; + $pria++; + }elseif($kelJns == "W"){ + $kelJns = "Wanita"; + $ttJmlBeli['wanita']['jml'] += $jmlBeli; + $ttJmlBeli['wanita']['rp'] += $rpBeli; + $ttJmlBeli['wanita']['hp'] += $hrgPokok; + $str[$wanita]['wanita'] = $strip; + $jmlB[$wanita]['wanita'] = $jmlBeli; + $rpB[$wanita]['wanita'] = $rpBeli; + $HP[$wanita]['wanita'] = $hrgPokok; + $kdSupplier[$wanita]['wanita'] = $kdSuppl; + $nmSupplier[$wanita]['wanita'] = $nmSuppl; + $wanita++; + }elseif($kelJns == "A"){ + $kelJns = "Anak"; + $ttJmlBeli['anak']['jml'] += $jmlBeli; + $ttJmlBeli['anak']['rp'] += $rpBeli; + $ttJmlBeli['anak']['hp'] += $hrgPokok; + $str[$anak]['anak'] = $strip; + $jmlB[$anak]['anak'] = $jmlBeli; + $rpB[$anak]['anak'] = $rpBeli; + $HP[$anak]['anak'] = $hrgPokok; + $kdSupplier[$anak]['anak'] = $kdSuppl; + $nmSupplier[$anak]['anak'] = $nmSuppl; + $anak++; + }else{ + $kelJns = "Sepatu"; + $ttJmlBeli['sepatu']['jml'] += $jmlBeli; + $ttJmlBeli['sepatu']['rp'] += $rpBeli; + $ttJmlBeli['sepatu']['hp'] += $hrgPokok; + $str[$sepatu]['sepatu'] = $strip; + $jmlB[$sepatu]['sepatu'] = $jmlBeli; + $rpB[$sepatu]['sepatu'] = $rpBeli; + $HP[$sepatu]['sepatu'] = $hrgPokok; + $kdSupplier[$sepatu]['sepatu'] = $kdSuppl; + $nmSupplier[$sepatu]['sepatu'] = $nmSuppl; + $sepatu++; + } + + } + print(""); + print(""); + print("
"); + + +/* SEPATU -------------------------------------------------------------------------*/ + $jmlkatsepatu = $ttJmlBeli['sepatu']['jml']; + $rpkatsepatu = $ttJmlBeli['sepatu']['rp']; + $hpkatsepatu = $ttJmlBeli['sepatu']['hp']; + + if($ttJmlBeli['sepatu']['jml']!=0){ + print("
"); + for($i=0;$i<$sepatu;$i++){ + if ($str[$i-1]['sepatu']==$str[$i]['sepatu']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlah4 = 0; + $temphp4 = 0; + $temprp4 = 0; + } + $tempjumlah4 += $jmlB[$i]['sepatu']; + $temphp4 += $HP[$i]['sepatu']; + $temprp4 += $rpB[$i]['sepatu']; + } + print(""); + print(""); + } + + $ttjml = $jmlkatpria + $jmlkatwanita + $jmlkatanak + $jmlkatsepatu; + $ttrp = $rpkatpria + $rpkatwanita + $rpkatanak + $rpkatsepatu; + $tthp = $hpkatpria + $hpkatwanita + $hpkatanak + $hpkatsepatu; + + print(" + + + "); + print("
Lini ProdukKode Supp.Nama SupplierJumlah JualTotal JualTotal HP Jual
".$str[$i]['sepatu'].".".$kdSupplier[$i]['sepatu']."".$nmSupplier[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($rpB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlah4, 0, ",", ".")."".number_format($temprp4, 0, ",", ".")."".number_format($temphp4, 0, ",", ".")."
".$str[$i]['sepatu'].".".$kdSupplier[$i]['sepatu']."".$nmSupplier[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($rpB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlah4, 0, ",", ".")."".number_format($temprp4, 0, ",", ".")."".number_format($temphp4, 0, ",", ".")."
".number_format($ttJmlBeli['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['rp'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp'], 0, ",", ".")."
T O T A L : ".number_format($ttjml, 0, ",", ".")."".number_format($ttrp, 0, ",", ".")."".number_format($tthp, 0, ",", ".")."

"); + }else{ + echo "Tidak ada data penjualan untuk tanggal tersebut!"; + } + } +/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ +if ($kdsupp!=""){ +$query2 = "select s.kel_jns,s.nama_strip,kode_supplier,nama_supplier,sum(juml) vol,sum(tot) totHJ,sum(hp) totHP + from ( + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, + sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m, barang b,supplier u + where d.no_nota = m.no_nota + AND d.kd_barang = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and u.kd_supplier = '$kdsupp' + and d.harga_pokok IS NOT NULL + and m.status_nota = 'S' + and d.diskon <> 100 + and ((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) < (d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + UNION ALL + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,(-1*sum(jumlah)) juml, + (-1*sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100))) tot, + (-1*sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp + from d_nota_retur d,m_nota_retur m, barang b,supplier u + where d.no_nota = m.no_nota + AND d.kd_barang = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and u.kd_supplier = '$kdsupp' + and d.harga_pokok IS NOT NULL + and d.diskon <> 100 + and ((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) < (d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + UNION ALL + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, + sum((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_bon d,m_bon m, barang b,supplier u + where d.no_bon = m.no_bon + AND d.kd_brg = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and u.kd_supplier = '$kdsupp' + and d.harga_pokok IS NOT NULL + and d.diskon <> 100 + and ((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) < (d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) + and date(tgl_bon) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + ) vlini,strip s + where s.kd_strip = lini + group by s.kd_strip,kode_supplier + order by s.kd_strip,vol desc"; +}else{ +$query2 = "select s.kel_jns,s.nama_strip,kode_supplier,nama_supplier,sum(juml) vol,sum(tot) totHJ,sum(hp) totHP + from ( + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, + sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m, barang b,supplier u + where d.no_nota = m.no_nota + AND d.kd_barang = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and d.harga_pokok IS NOT NULL + and m.status_nota = 'S' + and d.diskon <> 100 + and ((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) < (d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + UNION ALL + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,(-1*sum(jumlah)) juml, + (-1*sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100))) tot, + (-1*sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp + from d_nota_retur d,m_nota_retur m, barang b,supplier u + where d.no_nota = m.no_nota + AND d.kd_barang = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and d.harga_pokok IS NOT NULL + and d.diskon <> 100 + and ((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) < (d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + UNION ALL + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, + sum((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_bon d,m_bon m, barang b,supplier u + where d.no_bon = m.no_bon + AND d.kd_brg = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and d.harga_pokok IS NOT NULL + and d.diskon <> 100 + and ((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) < (d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) + and date(tgl_bon) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + ) vlini,strip s + where s.kd_strip = lini + group by s.kd_strip,kode_supplier + order by s.kd_strip,vol desc"; +} + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$kelJns,$strip,$kdSuppl,$nmSuppl,$jmlBeli,$rpBeli,$hrgPokok); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml2'] = 0; + $ttJmlBeli['pria']['rp2'] = 0; + $ttJmlBeli['pria']['hp2'] = 0; + $ttJmlBeli['wanita']['jml2'] = 0; + $ttJmlBeli['wanita']['rp2'] = 0; + $ttJmlBeli['wanita']['hp2'] = 0; + $ttJmlBeli['anak']['jml2'] = 0; + $ttJmlBeli['anak']['rp2'] = 0; + $ttJmlBeli['anak']['hp2'] = 0; + $ttJmlBeli['sepatu']['jml2'] = 0; + $ttJmlBeli['sepatu']['rp2'] = 0; + $ttJmlBeli['sepatu']['hp2'] = 0; + + print("
"); + print("

Laporan Penjualan Rugi Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PADA TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $str = array(); + $jmlB = array(); + $rpB = array(); + $HP = array(); + $kdSupplier = array(); + $nmSupplier = array(); + + while(mysqli_stmt_fetch($stmt2)){ + if($jmlRetur == ''){ + $jmlRetur = 0; + } + if($rpRetur == ''){ + $rpRetur = 0; + } + if($kelJns == "P"){ + $kelJns = "Pria"; + $ttJmlBeli['pria']['jml2'] += $jmlBeli; + $ttJmlBeli['pria']['rp2'] += $rpBeli; + $ttJmlBeli['pria']['hp2'] += $hrgPokok; + $str[$pria]['pria'] = $strip; + $jmlB[$pria]['pria'] = $jmlBeli; + $rpB[$pria]['pria'] = $rpBeli; + $HP[$pria]['pria'] = $hrgPokok; + $kdSupplier[$pria]['pria'] = $kdSuppl; + $nmSupplier[$pria]['pria'] = $nmSuppl; + $pria++; + }elseif($kelJns == "W"){ + $kelJns = "Wanita"; + $ttJmlBeli['wanita']['jml2'] += $jmlBeli; + $ttJmlBeli['wanita']['rp2'] += $rpBeli; + $ttJmlBeli['wanita']['hp2'] += $hrgPokok; + $str[$wanita]['wanita'] = $strip; + $jmlB[$wanita]['wanita'] = $jmlBeli; + $rpB[$wanita]['wanita'] = $rpBeli; + $HP[$wanita]['wanita'] = $hrgPokok; + $kdSupplier[$wanita]['wanita'] = $kdSuppl; + $nmSupplier[$wanita]['wanita'] = $nmSuppl; + $wanita++; + }elseif($kelJns == "A"){ + $kelJns = "Anak"; + $ttJmlBeli['anak']['jml2'] += $jmlBeli; + $ttJmlBeli['anak']['rp2'] += $rpBeli; + $ttJmlBeli['anak']['hp2'] += $hrgPokok; + $str[$anak]['anak'] = $strip; + $jmlB[$anak]['anak'] = $jmlBeli; + $rpB[$anak]['anak'] = $rpBeli; + $HP[$anak]['anak'] = $hrgPokok; + $kdSupplier[$anak]['anak'] = $kdSuppl; + $nmSupplier[$anak]['anak'] = $nmSuppl; + $anak++; + }else{ + $kelJns = "Sepatu"; + $ttJmlBeli['sepatu']['jml2'] += $jmlBeli; + $ttJmlBeli['sepatu']['rp2'] += $rpBeli; + $ttJmlBeli['sepatu']['hp2'] += $hrgPokok; + $str[$sepatu]['sepatu'] = $strip; + $jmlB[$sepatu]['sepatu'] = $jmlBeli; + $rpB[$sepatu]['sepatu'] = $rpBeli; + $HP[$sepatu]['sepatu'] = $hrgPokok; + $kdSupplier[$sepatu]['sepatu'] = $kdSuppl; + $nmSupplier[$sepatu]['sepatu'] = $nmSuppl; + $sepatu++; + } + + } + print(""); + print(""); + print("
"); + +/* SEPATU -------------------------------------------------------------------------*/ + $jmlkatsepatu = $ttJmlBeli['sepatu']['jml2']; + $rpkatsepatu = $ttJmlBeli['sepatu']['rp2']; + $hpkatsepatu = $ttJmlBeli['sepatu']['hp2']; + + if($ttJmlBeli['sepatu']['jml2']!=0){ + print("
"); + for($i=0;$i<$sepatu;$i++){ + if ($str[$i-1]['sepatu']==$str[$i]['sepatu']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlahrugi4 = 0; + $temphprugi4 = 0; + $temprprugi4 = 0; + } + $tempjumlahrugi4 += $jmlB[$i]['sepatu']; + $temphprugi4 += $HP[$i]['sepatu']; + $temprprugi4 += $rpB[$i]['sepatu']; + } + print(""); + print(""); + } + + $ttjml = $jmlkatpria + $jmlkatwanita + $jmlkatanak + $jmlkatsepatu; + $ttrp = $rpkatpria + $rpkatwanita + $rpkatanak + $rpkatsepatu; + $tthp = $hpkatpria + $hpkatwanita + $hpkatanak + $hpkatsepatu; + + print(" + + + "); + print("
Lini ProdukKode Supp.Nama SupplierJml Jual RugiTotal Jual RugiTotal HP Rugi
".$str[$i]['sepatu'].".".$kdSupplier[$i]['sepatu']."".$nmSupplier[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($rpB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlahrugi4, 0, ",", ".")."".number_format($temprprugi4, 0, ",", ".")."".number_format($temphprugi4, 0, ",", ".")."
".$str[$i]['sepatu'].".".$kdSupplier[$i]['sepatu']."".$nmSupplier[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($rpB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlahrugi4, 0, ",", ".")."".number_format($temprprugi4, 0, ",", ".")."".number_format($temphprugi4, 0, ",", ".")."
".number_format($ttJmlBeli['sepatu']['jml2'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['rp2'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp2'], 0, ",", ".")."
T O T A L : ".number_format($ttjml, 0, ",", ".")."".number_format($ttrp, 0, ",", ".")."".number_format($tthp, 0, ",", ".")."

"); + }else{ + echo "Tidak ada data penjualan rugi untuk tanggal tersebut!"; + } + } + +/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ +if ($kdsupp!=""){ +$query3 = "select s.kel_jns,s.nama_strip,kode_supplier,nama_supplier,sum(juml) vol,sum(tot) totHJ,sum(hp) totHP + from ( + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, + sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m, barang b,supplier u + where d.no_nota = m.no_nota + AND d.kd_barang = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and u.kd_supplier = '$kdsupp' + and d.harga_pokok IS NOT NULL + and m.status_nota = 'S' + and d.diskon = 100 + and ((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) < (d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + UNION ALL + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,(-1*sum(jumlah)) juml, + (-1*sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100))) tot, + (-1*sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp + from d_nota_retur d,m_nota_retur m, barang b,supplier u + where d.no_nota = m.no_nota + AND d.kd_barang = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and u.kd_supplier = '$kdsupp' + and d.harga_pokok IS NOT NULL + and d.diskon = 100 + and ((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) < (d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + UNION ALL + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, + sum((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_bon d,m_bon m, barang b,supplier u + where d.no_bon = m.no_bon + AND d.kd_brg = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and u.kd_supplier = '$kdsupp' + and d.harga_pokok IS NOT NULL + and d.diskon = 100 + and ((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) < (d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) + and date(tgl_bon) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + ) vlini,strip s + where s.kd_strip = lini + group by s.kd_strip,kode_supplier + order by s.kd_strip,vol desc"; +}else{ +$query3 = "select s.kel_jns,s.nama_strip,kode_supplier,nama_supplier,sum(juml) vol,sum(tot) totHJ,sum(hp) totHP + from ( + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, + sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m, barang b,supplier u + where d.no_nota = m.no_nota + AND d.kd_barang = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and d.harga_pokok IS NOT NULL + and m.status_nota = 'S' + and d.diskon = 100 + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + UNION ALL + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,(-1*sum(jumlah)) juml, + (-1*sum((d.harga_jual * d.jumlah) - (d.harga_jual * d.jumlah * d.diskon / 100))) tot, + (-1*sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp + from d_nota_retur d,m_nota_retur m, barang b,supplier u + where d.no_nota = m.no_nota + AND d.kd_barang = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and d.harga_pokok IS NOT NULL + and d.diskon = 100 + and date(tgl_nota) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + UNION ALL + select b.kode_strip lini,b.kode_supplier, u.nama_supplier,sum(jumlah) juml, + sum((d.hrg_satuan * d.jumlah) - (d.hrg_satuan * d.jumlah * d.diskon / 100)) tot, + sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_bon d,m_bon m, barang b,supplier u + where d.no_bon = m.no_bon + AND d.kd_brg = b.kode_barang + AND b.kode_supplier = u.kd_supplier + and d.harga_pokok IS NOT NULL + and d.diskon = 100 + and date(tgl_bon) between '$startDate' and '$endDate' + group by b.kode_strip,b.kode_supplier + ) vlini,strip s + where s.kd_strip = lini + group by s.kd_strip,kode_supplier + order by s.kd_strip,vol desc"; +} + if($stmt3 = mysqli_prepare($conn,$query3)){ + mysqli_stmt_execute($stmt3); + mysqli_stmt_store_result($stmt3); + $cek3 = mysqli_stmt_num_rows($stmt3); + if($cek3 > 0){ + mysqli_stmt_bind_result($stmt3,$kelJns,$strip,$kdSuppl,$nmSuppl,$jmlBeli,$rpBeli,$hrgPokok); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml3'] = 0; + $ttJmlBeli['pria']['rp3'] = 0; + $ttJmlBeli['pria']['hp3'] = 0; + $ttJmlBeli['wanita']['jml3'] = 0; + $ttJmlBeli['wanita']['rp3'] = 0; + $ttJmlBeli['wanita']['hp3'] = 0; + $ttJmlBeli['anak']['jml3'] = 0; + $ttJmlBeli['anak']['rp3'] = 0; + $ttJmlBeli['anak']['hp3'] = 0; + $ttJmlBeli['sepatu']['jml3'] = 0; + $ttJmlBeli['sepatu']['rp3'] = 0; + $ttJmlBeli['sepatu']['hp3'] = 0; + + print("
"); + print("

Laporan Penjualan Diskon 100% Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PADA TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $str = array(); + $jmlB = array(); + $rpB = array(); + $HP = array(); + $kdSupplier = array(); + $nmSupplier = array(); + + while(mysqli_stmt_fetch($stmt3)){ + if($jmlRetur == ''){ + $jmlRetur = 0; + } + if($rpRetur == ''){ + $rpRetur = 0; + } + if($kelJns == "P"){ + $kelJns = "Pria"; + $ttJmlBeli['pria']['jml3'] += $jmlBeli; + $ttJmlBeli['pria']['rp3'] += $rpBeli; + $ttJmlBeli['pria']['hp3'] += $hrgPokok; + $str[$pria]['pria'] = $strip; + $jmlB[$pria]['pria'] = $jmlBeli; + $rpB[$pria]['pria'] = $rpBeli; + $HP[$pria]['pria'] = $hrgPokok; + $kdSupplier[$pria]['pria'] = $kdSuppl; + $nmSupplier[$pria]['pria'] = $nmSuppl; + $pria++; + }elseif($kelJns == "W"){ + $kelJns = "Wanita"; + $ttJmlBeli['wanita']['jml3'] += $jmlBeli; + $ttJmlBeli['wanita']['rp3'] += $rpBeli; + $ttJmlBeli['wanita']['hp3'] += $hrgPokok; + $str[$wanita]['wanita'] = $strip; + $jmlB[$wanita]['wanita'] = $jmlBeli; + $rpB[$wanita]['wanita'] = $rpBeli; + $HP[$wanita]['wanita'] = $hrgPokok; + $kdSupplier[$wanita]['wanita'] = $kdSuppl; + $nmSupplier[$wanita]['wanita'] = $nmSuppl; + $wanita++; + }elseif($kelJns == "A"){ + $kelJns = "Anak"; + $ttJmlBeli['anak']['jml3'] += $jmlBeli; + $ttJmlBeli['anak']['rp3'] += $rpBeli; + $ttJmlBeli['anak']['hp3'] += $hrgPokok; + $str[$anak]['anak'] = $strip; + $jmlB[$anak]['anak'] = $jmlBeli; + $rpB[$anak]['anak'] = $rpBeli; + $HP[$anak]['anak'] = $hrgPokok; + $kdSupplier[$anak]['anak'] = $kdSuppl; + $nmSupplier[$anak]['anak'] = $nmSuppl; + $anak++; + }else{ + $kelJns = "Sepatu"; + $ttJmlBeli['sepatu']['jml3'] += $jmlBeli; + $ttJmlBeli['sepatu']['rp3'] += $rpBeli; + $ttJmlBeli['sepatu']['hp3'] += $hrgPokok; + $str[$sepatu]['sepatu'] = $strip; + $jmlB[$sepatu]['sepatu'] = $jmlBeli; + $rpB[$sepatu]['sepatu'] = $rpBeli; + $HP[$sepatu]['sepatu'] = $hrgPokok; + $kdSupplier[$sepatu]['sepatu'] = $kdSuppl; + $nmSupplier[$sepatu]['sepatu'] = $nmSuppl; + $sepatu++; + } + + } + print(""); + print(""); + print("
"); + +/* SEPATU -------------------------------------------------------------------------*/ + $jmlkatsepatu = $ttJmlBeli['sepatu']['jml3']; + $rpkatsepatu = $ttJmlBeli['sepatu']['rp3']; + $hpkatsepatu = $ttJmlBeli['sepatu']['hp3']; + + if($ttJmlBeli['sepatu']['jml3']!=0){ + print("
"); + for($i=0;$i<$sepatu;$i++){ + if ($str[$i-1]['sepatu']==$str[$i]['sepatu']){ + print(""); + }else{ + print(""); + print(""); + $tempjumlahrugi4 = 0; + $temphprugi4 = 0; + $temprprugi4 = 0; + } + $tempjumlahrugi4 += $jmlB[$i]['sepatu']; + $temphprugi4 += $HP[$i]['sepatu']; + $temprprugi4 += $rpB[$i]['sepatu']; + } + print(""); + print(""); + } + + $ttjml = $jmlkatpria + $jmlkatwanita + $jmlkatanak + $jmlkatsepatu; + $ttrp = $rpkatpria + $rpkatwanita + $rpkatanak + $rpkatsepatu; + $tthp = $hpkatpria + $hpkatwanita + $hpkatanak + $hpkatsepatu; + + print(" + + + "); + print("
Lini ProdukKode Supp.Nama SupplierJumlah JualTotal JualTotal HP Jual
".$str[$i]['sepatu'].".".$kdSupplier[$i]['sepatu']."".$nmSupplier[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($rpB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlahrugi4, 0, ",", ".")."".number_format($temprprugi4, 0, ",", ".")."".number_format($temphprugi4, 0, ",", ".")."
".$str[$i]['sepatu'].".".$kdSupplier[$i]['sepatu']."".$nmSupplier[$i]['sepatu']."".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($rpB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($tempjumlahrugi4, 0, ",", ".")."".number_format($temprprugi4, 0, ",", ".")."".number_format($temphprugi4, 0, ",", ".")."
".number_format($ttJmlBeli['sepatu']['jml3'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['rp3'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp3'], 0, ",", ".")."
T O T A L : ".number_format($ttjml, 0, ",", ".")."".number_format($ttrp, 0, ",", ".")."".number_format($tthp, 0, ",", ".")."

"); + }else{ + echo "Tidak ada data penjualan diskon 100% untuk tanggal tersebut!"; + } + } +} +?> diff --git a/old-source/LaporanJual/lapkomposisi.php b/old-source/LaporanJual/lapkomposisi.php new file mode 100644 index 0000000..5eef318 --- /dev/null +++ b/old-source/LaporanJual/lapkomposisi.php @@ -0,0 +1,386 @@ +"; + echo "table.tbl {width:80%;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + if(bukaKoneksi()){ + global $conn; + $query = "select vX.tgl,A,totA,B,totB,C,totC,D,totD,E,totE,F,totF,G,totG,H,totH + from + (SELECT date(tgl_nota) tgl,count(*) x,sum(jumlah_total) totx + FROM m_nota_tunai m + WHERE + date(tgl_nota) between '$startDate' AND '$endDate' + group by tgl)vX + LEFT OUTER JOIN + (SELECT date(tgl_nota) tgl,count(*) A,sum(jumlah_total) totA + FROM m_nota_tunai m + WHERE + m.status_nota = 'S' + and m.jumlah_total <= 100000 + and date(tgl_nota) between '$startDate' AND '$endDate' + group by tgl)vA + ON vX.tgl = vA.tgl + LEFT OUTER JOIN + (SELECT date(tgl_nota) tgl,count(*) B,sum(jumlah_total) totB + FROM m_nota_tunai m + WHERE + m.status_nota = 'S' + and m.jumlah_total >= 100001 and m.jumlah_total <= 200000 + and date(tgl_nota) between '$startDate' AND '$endDate' + group by tgl)vB + ON vX.tgl = vB.tgl + LEFT OUTER JOIN + (SELECT date(tgl_nota) tgl,count(*) C,sum(jumlah_total) totC + FROM m_nota_tunai m + WHERE + m.status_nota = 'S' + and m.jumlah_total >= 200001 and m.jumlah_total <= 300000 + and date(tgl_nota) between '$startDate' AND '$endDate' + group by tgl)vC + ON vX.tgl = vC.tgl + LEFT OUTER JOIN + (SELECT date(tgl_nota) tgl,count(*) D,sum(jumlah_total) totD + FROM m_nota_tunai m + WHERE + m.status_nota = 'S' + and m.jumlah_total >= 300001 and m.jumlah_total <= 400000 + and date(tgl_nota) between '$startDate' AND '$endDate' + group by tgl)vD + ON vX.tgl = vD.tgl + LEFT OUTER JOIN + (SELECT date(tgl_nota) tgl,count(*) E,sum(jumlah_total) totE + FROM m_nota_tunai m + WHERE + m.status_nota = 'S' + and m.jumlah_total >= 400001 and m.jumlah_total <= 500000 + and date(tgl_nota) between '$startDate' AND '$endDate' + group by tgl)vE + ON vX.tgl = vE.tgl + LEFT OUTER JOIN + (SELECT date(tgl_nota) tgl,count(*) F,sum(jumlah_total) totF + FROM m_nota_tunai m + WHERE + m.status_nota = 'S' + and m.jumlah_total >= 500001 and m.jumlah_total <= 600000 + and date(tgl_nota) between '$startDate' AND '$endDate' + group by tgl)vF + ON vX.tgl = vF.tgl + LEFT OUTER JOIN + (SELECT date(tgl_nota) tgl,count(*) G,sum(jumlah_total) totG + FROM m_nota_tunai m + WHERE + m.status_nota = 'S' + and m.jumlah_total >= 600001 and m.jumlah_total <= 1250000 + and date(tgl_nota) between '$startDate' AND '$endDate' + group by tgl)vG + ON vX.tgl = vG.tgl + LEFT OUTER JOIN + (SELECT date(tgl_nota) tgl,count(*) H,sum(jumlah_total) totH + FROM m_nota_tunai m + WHERE + m.status_nota = 'S' + and m.jumlah_total >= 1250001 + and date(tgl_nota) between '$startDate' AND '$endDate' + group by tgl)vH + ON vX.tgl = vH.tgl"; + $query2 = "select vX.tgl,A,totA,B,totB,C,totC,D,totD,E,totE,F,totF,G,totG,H,totH + from + (SELECT date(tgl_bon) tgl,count(*) x,sum(jumlah_total) totx + FROM m_bon m + WHERE + date(tgl_bon) between '$startDate' AND '$endDate' + group by tgl)vX + LEFT OUTER JOIN + (SELECT date(tgl_bon) tgl,count(*) A,sum(jumlah_total) totA + FROM m_bon m + WHERE + m.jumlah_total <= 100000 + and date(tgl_bon) between '$startDate' AND '$endDate' + group by tgl)vA + ON vX.tgl = vA.tgl + LEFT OUTER JOIN + (SELECT date(tgl_bon) tgl,count(*) B,sum(jumlah_total) totB + FROM m_bon m + WHERE + m.jumlah_total >= 100001 and m.jumlah_total <= 200000 + and date(tgl_bon) between '$startDate' AND '$endDate' + group by tgl)vB + ON vX.tgl = vB.tgl + LEFT OUTER JOIN + (SELECT date(tgl_bon) tgl,count(*) C,sum(jumlah_total) totC + FROM m_bon m + WHERE + m.jumlah_total >= 200001 and m.jumlah_total <= 300000 + and date(tgl_bon) between '$startDate' AND '$endDate' + group by tgl)vC + ON vX.tgl = vC.tgl + LEFT OUTER JOIN + (SELECT date(tgl_bon) tgl,count(*) D,sum(jumlah_total) totD + FROM m_bon m + WHERE + m.jumlah_total >= 300001 and m.jumlah_total <= 400000 + and date(tgl_bon) between '$startDate' AND '$endDate' + group by tgl)vD + ON vX.tgl = vD.tgl + LEFT OUTER JOIN + (SELECT date(tgl_bon) tgl,count(*) E,sum(jumlah_total) totE + FROM m_bon m + WHERE + m.jumlah_total >= 400001 and m.jumlah_total <= 500000 + and date(tgl_bon) between '$startDate' AND '$endDate' + group by tgl)vE + ON vX.tgl = vE.tgl + LEFT OUTER JOIN + (SELECT date(tgl_bon) tgl,count(*) F,sum(jumlah_total) totF + FROM m_bon m + WHERE + m.jumlah_total >= 500001 and m.jumlah_total <= 600000 + and date(tgl_bon) between '$startDate' AND '$endDate' + group by tgl)vF + ON vX.tgl = vF.tgl + LEFT OUTER JOIN + (SELECT date(tgl_bon) tgl,count(*) G,sum(jumlah_total) totG + FROM m_bon m + WHERE + m.jumlah_total >= 600001 and m.jumlah_total <= 1250000 + and date(tgl_bon) between '$startDate' AND '$endDate' + group by tgl)vG + ON vX.tgl = vG.tgl + LEFT OUTER JOIN + (SELECT date(tgl_bon) tgl,count(*) H,sum(jumlah_total) totH + FROM m_bon m + WHERE + m.jumlah_total >= 1250001 + and date(tgl_bon) between '$startDate' AND '$endDate' + group by tgl)vH + ON vX.tgl = vH.tgl"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tgl,$A,$totA,$B,$totB,$C,$totC,$D,$totD,$E,$totE,$F,$totF,$G,$totG,$H,$totH); + $ttJumlah = array(); + $ttJumlah['jmltunai'] = 0; + $ttJumlah['rptunai'] = 0; + + print("
"); + print("

Rekap Transaksi Per Komposisi Penjualan Tunai



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(" + + "); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['jmltunai'] += $A+$B+$C+$D+$E+$F+$G+$H; + $ttJumlah['rptunai'] += $totA+$totB+$totC+$totD+$totE+$totF+$totG+$totH; + print(""); + } + + print("
Tanggal<=100.000Rupiah100.001-200.000Rupiah200.001-300.000Rupiah300.001-400.000Rupiah400.001-500.000Rupiah500.001-600.000Rupiah600.001-1.250.000Rupiah>=1.250.001Rupiah
".encTgl($tgl)."$A".number_format($totA,0,',','.')."$B".number_format($totB,0,',','.')."$C".number_format($totC,0,',','.')."$D".number_format($totD,0,',','.')."$E".number_format($totE,0,',','.')."$F".number_format($totF,0,',','.')."$G".number_format($totG,0,',','.')."$H".number_format($totH,0,',','.')."

"); + print("
"); + + print(""); + print(""); + print("
Total Jumlah Transaksi : ".number_format($ttJumlah['jmltunai'],0,',','.')."
Total Rupiah Transaksi : ".number_format($ttJumlah['rptunai'],0,',','.')."
"); + }else{ + echo "Belum ada data transaksi tunai untuk tanggal tersebut!"; + } + } + $jmltunai = $ttJumlah['jmltunai']; + $rptunai = $ttJumlah['rptunai']; + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$tgl,$A,$totA,$B,$totB,$C,$totC,$D,$totD,$E,$totE,$F,$totF,$G,$totG,$H,$totH); + $ttJumlah = array(); + $ttJumlah['jmlbon'] = 0; + $ttJumlah['rpbon'] = 0; + + print("
"); + print("

Rekap Transaksi Per Komposisi Penjualan Bon



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(" + + "); + while(mysqli_stmt_fetch($stmt2)){ + $ttJumlah['jmlbon'] += $A+$B+$C+$D+$E+$F+$G+$H; + $ttJumlah['rpbon'] += $totA+$totB+$totC+$totD+$totE+$totF+$totG+$totH; + print(""); + } + + print("
Tanggal<=100.000Rupiah100.001-200.000Rupiah200.001-300.000Rupiah300.001-400.000Rupiah400.001-500.000Rupiah500.001-600.000Rupiah600.001-1.250.000Rupiah>=1.250.001Rupiah
".encTgl($tgl)."$A".number_format($totA,0,',','.')."$B".number_format($totB,0,',','.')."$C".number_format($totC,0,',','.')."$D".number_format($totD,0,',','.')."$E".number_format($totE,0,',','.')."$F".number_format($totF,0,',','.')."$G".number_format($totG,0,',','.')."$H".number_format($totH,0,',','.')."

"); + print("
"); + + print(""); + print(""); + print("
Total Jumlah Transaksi Bon: ".number_format($ttJumlah['jmlbon'],0,',','.')."
Total Rupiah Transaksi Bon: ".number_format($ttJumlah['rpbon'],0,',','.')."
"); + }else{ + echo "Belum ada data transaksi bon untuk tanggal tersebut!"; + } + } + $jmlbon = $ttJumlah['jmlbon']; + $rpbon = $ttJumlah['rpbon']; + + $totaljml = $jmltunai + $jmlbon; + $totalrp = $rptunai + $rpbon; + + print("
"); + print("_______________________________________________"); + print(""); + print(""); + print("
Total jumlah transaksi : ".number_format($totaljml,0,',','.')."
Total rupiah transaksi : ".number_format($totalrp,0,',','.')."
"); + +print("
"); + $query3 = "SELECT vX.kd_customer,vX.nama,A,totA,B,totB,C,totC,D,totD,E,totE,F,totF + FROM + (SELECT p.kd_customer,p.nama + FROM pelanggan p, m_nota_tunai m + WHERE + m.status_nota = 'S' + and p.kd_customer = m.kd_customer + and date(tgl_nota) between '$startDate' AND '$endDate' + group by p.kd_customer)vX + LEFT OUTER JOIN + (SELECT m.kd_customer,count(*) A,sum(jumlah_total) totA + FROM m_nota_tunai m + WHERE + m.status_nota = 'S' + and m.jumlah_total >= 200000 and m.jumlah_total <= 350000 + and date(tgl_nota) between '$startDate' AND '$endDate' + group by kd_customer)vA + ON vX.kd_customer = vA.kd_customer + LEFT OUTER JOIN + (SELECT m.kd_customer,count(*) B,sum(jumlah_total) totB + FROM m_nota_tunai m + WHERE + m.status_nota = 'S' + and m.jumlah_total > 350000 and m.jumlah_total <= 500000 + and date(tgl_nota) between '$startDate' AND '$endDate' + group by kd_customer)vB + ON vX.kd_customer = vB.kd_customer + LEFT OUTER JOIN + (SELECT m.kd_customer,count(*) C,sum(jumlah_total) totC + FROM m_nota_tunai m + WHERE + m.status_nota = 'S' + and m.jumlah_total > 500000 and m.jumlah_total <= 650000 + and date(tgl_nota) between '$startDate' AND '$endDate' + group by kd_customer)vC + ON vX.kd_customer = vC.kd_customer + LEFT OUTER JOIN + (SELECT m.kd_customer,count(*) D,sum(jumlah_total) totD + FROM m_nota_tunai m + WHERE + m.status_nota = 'S' + and m.jumlah_total > 650000 and m.jumlah_total <= 800000 + and date(tgl_nota) between '$startDate' AND '$endDate' + group by kd_customer)vD + ON vX.kd_customer = vD.kd_customer + LEFT OUTER JOIN + (SELECT m.kd_customer,count(*) E,sum(jumlah_total) totE + FROM m_nota_tunai m + WHERE + m.status_nota = 'S' + and m.jumlah_total > 800000 and m.jumlah_total <= 950000 + and date(tgl_nota) between '$startDate' AND '$endDate' + group by kd_customer)vE + ON vX.kd_customer = vE.kd_customer + LEFT OUTER JOIN + (SELECT m.kd_customer,count(*) F,sum(jumlah_total) totF + FROM m_nota_tunai m + WHERE + m.status_nota = 'S' + and m.jumlah_total > 950000 + and date(tgl_nota) between '$startDate' AND '$endDate' + group by kd_customer)vF + ON vX.kd_customer = vF.kd_customer + WHERE A is not NULL OR B is not NULL OR C is not NULL OR D is not NULL OR E is not NULL OR F is not NULL"; + + if($stmt3 = mysqli_prepare($conn,$query3)){ + mysqli_stmt_execute($stmt3); + mysqli_stmt_store_result($stmt3); + $cek3 = mysqli_stmt_num_rows($stmt3); + if($cek3 > 0){ + mysqli_stmt_bind_result($stmt3,$kd_customer,$nama,$A,$totA,$B,$totB,$C,$totC,$D,$totD,$E,$totE,$F,$totF); + $ttJumlah = array(); + $ttJumlah['jmlbon'] = 0; + $ttJumlah['rpbon'] = 0; + + print("
"); + print("

Rekap POINT PELANGGAN



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(" + + + + + + + + "); + while(mysqli_stmt_fetch($stmt3)){ + $ttJumlah['jumlah'] += $A+$B+$C+$D+$E+$F; + $ttJumlah['rupiah'] += $totA+$totB+$totC+$totD+$totE+$totF; + $pointA = $A*2; + $pointB = $B*4; + $pointC = $C*7; + $pointD = $D*10; + $pointE = $E*15; + $pointF = $F*25; + $ttJumlahPoint = $pointA+$pointB+$pointC+$pointD+$pointE+$pointF; + + print(" + + + + + + + "); + } + + print("
Kd PlgNama200.000-350.000RupiahPoint A350.001-500.000RupiahPoint B500.001-650.000RupiahPoint C650.001-800.000RupiahPoint D800.001-950.000RupiahPoint E>950.000RupiahPoint FTOTAL POINT
$kd_customer$nama$A".number_format($totA,0,',','.')."$pointA$B".number_format($totB,0,',','.')."$pointB$C".number_format($totC,0,',','.')."$pointC$D".number_format($totD,0,',','.')."$pointD$E".number_format($totE,0,',','.')."$pointE$F".number_format($totF,0,',','.')."$pointF$ttJumlahPoint

"); + print("
"); + + print(""); + print(""); + print("
Total Jumlah Transaksi: ".number_format($ttJumlah['jumlah'],0,',','.')."
Total Rupiah Transaksi: ".number_format($ttJumlah['rupiah'],0,',','.')."
"); + }else{ + echo "Belum ada data transaksi untuk tanggal tersebut!"; + } + } + + } +?> diff --git a/old-source/LaporanJual/lappk8.php b/old-source/LaporanJual/lappk8.php new file mode 100644 index 0000000..3abe00a --- /dev/null +++ b/old-source/LaporanJual/lappk8.php @@ -0,0 +1,138 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $th1 = substr($startDate,0,4) - 1; + $bulan1 = substr($startDate,5,2); + $tgl1 = substr($startDate,8,2); + $th2 = substr($endDate,0,4) - 1; + $bulan2 = substr($endDate,5,2); + $tgl2 = substr($endDate,8,2); + + $startlalu = $th1."-".$bulan1."-".$tgl1; + $endlalu = $th2."-".$bulan2."-".$tgl2; + + + if(bukaKoneksi()){ + global $conn; + $query = "select tempskrg.tanggal,tempskrg.Skrg bulanIni,templalu.Lalu bulanLalu + from + + (select tanggal,sum(vskrg.total) Skrg + from (select date(m.tgl_nota) tanggal,sum(m.jumlah_total) TOTAL + FROM m_nota_tunai m + where m.status_bayar = 'T' + and m.status_nota = 'S' + and m.no_nota_retur = '' + and date(m.tgl_nota) BETWEEN '$startDate' and '$endDate' + group by date(m.tgl_nota) + UNION ALL + select date(m.tgl_nota) tanggal,sum(jumlah_total-jumlah_total_retur) TOTAL + from m_nota_tunai m + where m.status_bayar = 'T' + and m.no_nota_retur != '' + and m.status_nota = 'S' + and date(m.tgl_nota) BETWEEN '$startDate' and '$endDate' + group by date(m.tgl_nota) + UNION ALL + select date(m.tgl_nota) tanggal,sum(-1*m.jumlah_total) TOTAL + from m_nota_retur m + where m.status_nota = 'D' + and date(m.tgl_nota) BETWEEN '$startDate' and '$endDate' + group by date(m.tgl_nota) + UNION ALL + select date(t.tgl_byr) tanggal,sum(t.bayar_bon) total + from bayar_bon t + where date(t.tgl_byr) between '$startDate' and '$endDate' + group by date(t.tgl_byr) + )vskrg group by tanggal)tempskrg + LEFT JOIN + (select tanggal,sum(vskrg.total) Lalu + from (select date(m.tgl_nota) tanggal,sum(m.jumlah_total) TOTAL + FROM m_nota_tunai m + where m.status_bayar = 'T' + and m.status_nota = 'S' + and m.no_nota_retur = '' + and date(m.tgl_nota) BETWEEN '$startlalu' and '$endlalu' + group by date(m.tgl_nota) + UNION ALL + select date(m.tgl_nota) tanggal,sum(jumlah_total-jumlah_total_retur) TOTAL + from m_nota_tunai m + where m.status_bayar = 'T' + and m.no_nota_retur != '' + and m.status_nota = 'S' + and date(m.tgl_nota) BETWEEN '$startlalu' and '$endlalu' + group by date(m.tgl_nota) + UNION ALL + select date(m.tgl_nota) tanggal,sum(-1*m.jumlah_total) TOTAL + from m_nota_retur m + where m.status_nota = 'D' + and date(m.tgl_nota) BETWEEN '$startlalu' and '$endlalu' + group by date(m.tgl_nota) + UNION ALL + select date(t.tgl_byr) tanggal,sum(t.bayar_bon) total + from bayar_bon t + where date(t.tgl_byr) between '$startlalu' and '$endlalu' + group by date(t.tgl_byr) + )vskrg group by tanggal)templalu + on day(tempskrg.tanggal)=day(templalu.tanggal)"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tgl,$sekarang,$lalu); + $ttJumlah = array(); + $ttJumlah['jml1'] = 0; + $ttJumlah['jml2'] = 0; + + print("
"); + print("

Rekap Transaksi Penjualan Perbandingan Tahun Lalu



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['jml1'] += $sekarang; + $ttJumlah['jml2'] += $lalu; + if ($lalu == 0) { + $peningkatan = 100; + }else{ + $peningkatan = ($sekarang - $lalu)/$lalu*100; + } + print(""); + } + + print("
TanggalLaluSekarangPeningkatan (%)
".encTgl($tgl)."".number_format($lalu,0,',','.')."".number_format($sekarang,0,',','.')."".number_format($peningkatan,2)."

"); + print("
"); + print(""); + print(""); + print("
Total Penjualan Periode Tahun Lalu : ".number_format($ttJumlah['jml2'],0,',','.')."
Total Penjualan Periode Tahun Sekarang : ".number_format($ttJumlah['jml1'],0,',','.')."
"); + }else{ + echo "Belum ada data transaksi untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanJual/lapstok.php b/old-source/LaporanJual/lapstok.php new file mode 100644 index 0000000..13e9e23 --- /dev/null +++ b/old-source/LaporanJual/lapstok.php @@ -0,0 +1,298 @@ +"; + echo "div#divprint{width:780px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:450px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + + if(bukaKoneksi()){ + global $conn; + + $query = "SELECT s.kd_strip,s.nama_strip,k.ked_produk,sum(n.stok) jumlah, + SUM(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok) + totalHP + FROM barang b,no_barang n,strip s,kedalaman_produk k + WHERE n.stok>0 + and b.id_gabungan = n.id_gabungan + and s.kd_strip = b.kode_strip + and (b.kode_strip = k.kode_strip and b.ked_produk = k.kode_ked_produk) + GROUP BY b.kode_strip,b.ked_produk"; + + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kelJns,$strip,$subprod,$jmlBeli,$hrgPokok); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['rp'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['rp'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['rp'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['rp'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + + print("
"); + print("

Laporan Persediaan Barang Per Kelompok Kategori



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $kdstr = array(); + $str = array(); + $subprod = array(); + $jmlB = array(); + $rpB = array(); + $HP = array(); + + while(mysqli_stmt_fetch($stmt)){ + + $kdstr[$sepatu]['sepatu'] = $kelJns; + $ttJmlBeli['sepatu']['jml'] += $jmlBeli; + $ttJmlBeli['sepatu']['hp'] += $hrgPokok; + $str[$sepatu]['sepatu'] = $strip; + $sub[$sepatu]['sepatu'] = $subprod; + $jmlB[$sepatu]['sepatu'] = $jmlBeli; + $HP[$sepatu]['sepatu'] = $hrgPokok; + $sepatu++; + + + } + print(""); + print(""); + print("
"); + +/* SEPATU -------------------------------------------------------------------------*/ + if($ttJmlBeli['sepatu']['jml']!=0){ + print("
"); + $adaR = false; + for($i=0;$i<$sepatu;$i++){ + if(!$adaR){ + print(""); + } + } + print(""); + } + + print("
Kd. Lini ProdukLini ProdukKedalaman ProdukJumlah BarangTotal HP
".$kdstr[$i]['sepatu']."".$str[$i]['sepatu']."".$sub[$i]['sepatu']." ".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($ttJmlBeli['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp'], 0, ",", ".")."

"); + print("
"); + $ttJml = $ttJmlBeli['pria']['jml'] + $ttJmlBeli['wanita']['jml'] + $ttJmlBeli['anak']['jml'] + $ttJmlBeli['sepatu']['jml']; + $ttRp = $ttJmlBeli['pria']['hp'] + $ttJmlBeli['wanita']['hp'] + $ttJmlBeli['anak']['hp'] + $ttJmlBeli['sepatu']['hp']; + print(""); + print(""); + print("
Total Jumlah Barang : ".number_format($ttJml,0,',','.')."
Total Persediaan : ".number_format($ttRp,0,',','.')."
"); + }else{ + echo "Belum ada data untuk tanggal tersebut!"; + } + } + + $query3 = "SELECT s.kd_strip,s.nama_strip,k.ked_produk,sum(n.stok) jumlah, + SUM(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok) + totalHP + from barang b,no_barang n,strip s,kedalaman_produk k + WHERE n.stok<0 + and b.id_gabungan = n.id_gabungan + and s.kd_strip = b.kode_strip + and (b.kode_strip = k.kode_strip and b.ked_produk = k.kode_ked_produk) + GROUP BY b.kode_strip,b.ked_produk"; + + + if($stmt3 = mysqli_prepare($conn,$query3)){ + mysqli_stmt_execute($stmt3); + mysqli_stmt_store_result($stmt3); + $cek3 = mysqli_stmt_num_rows($stmt3); + if($cek3 > 0){ + mysqli_stmt_bind_result($stmt3,$kelJns,$strip,$subprod,$jmlBeli,$hrgPokok); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['rp'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['rp'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['rp'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['rp'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + + print("
"); + print("

Laporan Kontrol Persediaan Barang Minus Per Kelompok Kategori



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $kdstr = array(); + $str = array(); + $sub = array(); + $jmlB = array(); + $rpB = array(); + $HP = array(); + + while(mysqli_stmt_fetch($stmt3)){ + + $kdstr[$sepatu]['sepatu'] = $kelJns; + $ttJmlBeli['sepatu']['jml'] += $jmlBeli; + $ttJmlBeli['sepatu']['hp'] += $hrgPokok; + $str[$sepatu]['sepatu'] = $strip; + $sub[$sepatu]['sepatu'] = $subprod; + $jmlB[$sepatu]['sepatu'] = $jmlBeli; + $HP[$sepatu]['sepatu'] = $hrgPokok; + $sepatu++; + + } + print(""); + print(""); + print("
"); + + +/* SEPATU -------------------------------------------------------------------------*/ + if($ttJmlBeli['sepatu']['jml']!=0){ + print("
"); + $adaR = false; + for($i=0;$i<$sepatu;$i++){ + if(!$adaR){ + print(""); + } + } + print(""); + } + + print("
Kd. Lini ProdukLini ProdukKedalaman ProdukJumlah BarangTotal HP
".$kdstr[$i]['sepatu']."".$str[$i]['sepatu']."".$sub[$i]['sepatu']." ".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($ttJmlBeli['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp'], 0, ",", ".")."

"); + print("
"); + $ttJml = $ttJmlBeli['pria']['jml'] + $ttJmlBeli['wanita']['jml'] + $ttJmlBeli['anak']['jml'] + $ttJmlBeli['sepatu']['jml']; + $ttRp = $ttJmlBeli['pria']['hp'] + $ttJmlBeli['wanita']['hp'] + $ttJmlBeli['anak']['hp'] + $ttJmlBeli['sepatu']['hp']; + print(""); + print(""); + print("
Total Jumlah Barang : ".number_format($ttJml,0,',','.')."
Total Persediaan : ".number_format($ttRp,0,',','.')."
"); + }else{ + echo "Tidak ada data stok minus untuk tanggal tersebut!"; + } + } + + $query2 = "select tKonsy.kd_strip,tKonsy.nama_strip,tKonsy.ked_produk,sum(tKonsy.stok),sum(tKonsy.totalHP) + FROM + (select s.kd_strip,s.nama_strip,k.ked_produk,n.stok, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP + from barang b,no_barang n,strip s,m_pembelian m,d_pembelian d, kedalaman_produk k + where n.stok>0 + AND b.id_gabungan = n.id_gabungan + AND s.kd_strip = b.kode_strip + and (b.kode_strip = k.kode_strip and b.ked_produk = k.kode_ked_produk) + AND m.no_faktur = d.no_faktur + AND (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + AND m.validasi = '1' + AND m.status = 'K' + group by b.id_gabungan) tKonsy + GROUP BY tKonsy.kd_strip,tKonsy.ked_produk"; + + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$kelJns,$strip,$subprod,$jmlBeli,$hrgPokok); + $ttJmlBeli = array(); + $ttJmlBeli['pria']['jml'] = 0; + $ttJmlBeli['pria']['rp'] = 0; + $ttJmlBeli['pria']['hp'] = 0; + $ttJmlBeli['wanita']['jml'] = 0; + $ttJmlBeli['wanita']['rp'] = 0; + $ttJmlBeli['wanita']['hp'] = 0; + $ttJmlBeli['anak']['jml'] = 0; + $ttJmlBeli['anak']['rp'] = 0; + $ttJmlBeli['anak']['hp'] = 0; + $ttJmlBeli['sepatu']['jml'] = 0; + $ttJmlBeli['sepatu']['rp'] = 0; + $ttJmlBeli['sepatu']['hp'] = 0; + + print("
"); + print("

Laporan Persediaan Barang Konsinyasi Per Kelompok Kategori



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + $pria = 0; + $wanita = 0; + $anak = 0; + $sepatu = 0; + $kdstr = array(); + $str = array(); + $sub = array(); + $jmlB = array(); + $rpB = array(); + $HP = array(); + + while(mysqli_stmt_fetch($stmt2)){ + + $kdstr[$sepatu]['sepatu'] = $kelJns; + $ttJmlBeli['sepatu']['jml'] += $jmlBeli; + $ttJmlBeli['sepatu']['hp'] += $hrgPokok; + $str[$sepatu]['sepatu'] = $strip; + $sub[$sepatu]['sepatu'] = $subprod; + $jmlB[$sepatu]['sepatu'] = $jmlBeli; + $HP[$sepatu]['sepatu'] = $hrgPokok; + $sepatu++; + + } + print(""); + print(""); + print("
"); + + +/* SEPATU -------------------------------------------------------------------------*/ + if($ttJmlBeli['sepatu']['jml']!=0){ + print("
"); + $adaR = false; + for($i=0;$i<$sepatu;$i++){ + if(!$adaR){ + print(""); + } + } + print(""); + } + + print("
Kd. Lini ProdukLini ProdukKedalaman ProdukJumlah BarangTotal HP
".$kdstr[$i]['sepatu']."".$str[$i]['sepatu']."".$sub[$i]['sepatu']." ".number_format($jmlB[$i]['sepatu'], 0, ",", ".")."".number_format($HP[$i]['sepatu'], 0, ",", ".")."
".number_format($ttJmlBeli['sepatu']['jml'], 0, ",", ".")."".number_format($ttJmlBeli['sepatu']['hp'], 0, ",", ".")."

"); + print("
"); + $ttJml = $ttJmlBeli['pria']['jml'] + $ttJmlBeli['wanita']['jml'] + $ttJmlBeli['anak']['jml'] + $ttJmlBeli['sepatu']['jml']; + $ttRp = $ttJmlBeli['pria']['hp'] + $ttJmlBeli['wanita']['hp'] + $ttJmlBeli['anak']['hp'] + $ttJmlBeli['sepatu']['hp']; + print(""); + print(""); + print("
Total Jumlah Barang : ".number_format($ttJml,0,',','.')."
Total Persediaan : ".number_format($ttRp,0,',','.')."
"); + }else{ + echo "Belum ada data konsinyasi untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanJual/lapstokps1c.php b/old-source/LaporanJual/lapstokps1c.php new file mode 100644 index 0000000..74c2d3c --- /dev/null +++ b/old-source/LaporanJual/lapstokps1c.php @@ -0,0 +1,222 @@ +"; + echo "div#divprint{width:1280px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:1180px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:50px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = $_POST['kdsupp']; + $endDate = $_POST['endDate']; + + + if(bukaKoneksi()){ + global $conn; + IF ($startDate != '' && $endDate != ''){ + + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,k.ked_produk,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ + FROM barang b,no_barang n, d_pembelian d, kedalaman_produk k + WHERE n.stok < 0 + and b.id_gabungan = n.id_gabungan + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and (b.ked_produk = k.kode_ked_produk and b.kode_strip = k.kode_strip) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_supplier = '$startDate' + and b.kode_strip = '$endDate' + GROUP BY b.id_gabungan + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + }elseif ($startDate == '' && $endDate != ''){ + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,k.ked_produk,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ + FROM barang b,no_barang n, d_pembelian d, kedalaman_produk k + WHERE n.stok < 0 + and b.id_gabungan = n.id_gabungan + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and (b.ked_produk = k.kode_ked_produk and b.kode_strip = k.kode_strip) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_strip = '$endDate' + GROUP BY b.id_gabungan + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + }else { + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,k.ked_produk,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ + FROM barang b,no_barang n, d_pembelian d, kedalaman_produk k + WHERE n.stok < 0 + and b.id_gabungan = n.id_gabungan + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and (b.ked_produk = k.kode_ked_produk and b.kode_strip = k.kode_strip) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_supplier = '$startDate' + GROUP BY b.id_gabungan + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + + } + $querysupp = "select nama_supplier from supplier where kd_supplier = '$startDate' "; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tahun,$bln,$strip,$kdasli,$kedproduk,$nofaktur,$kdbrg,$nmbrg,$nomor,$akhir,$pokok,$hp,$jual,$hj); + $ttJumlah = array(); + $ttJumlah['jml'] = 0; + $ttJumlah['hp'] = 0; + + print("
"); + print("

Laporan Barang Minus Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."

"); + if($stmtsupp = mysqli_prepare($conn,$querysupp)){ + mysqli_stmt_execute($stmtsupp); + mysqli_stmt_store_result($stmtsupp); + $ceksupp = mysqli_stmt_num_rows($stmtsupp); + if($ceksupp > 0){ + mysqli_stmt_bind_result($stmtsupp,$nama); + while(mysqli_stmt_fetch($stmtsupp)){ + print("Supplier : $nama


"); + } + } + } + print(""); + print("<"); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['jml'] += $akhir; + $ttJumlah['hp'] += $hp; + print(""); + } + + print("
TahunBulanLini Prod.Ked Prod.Kode AsliKode BarangNama BarangNomor Brg.Stok AkhirHPHJTot.HPTot.HJ
$tahun$bln$strip$kedproduk$kdasli$kdbrg$nmbrg$nomor$akhir".number_format($pokok,0,',','.')."".number_format($jual,0,',','.')."".number_format($hp,0,',','.')."".number_format($hj,0,',','.')."

"); + print("
"); + + print(""); + print(""); + + print("
Total Jumlah Barang : ".number_format($ttJumlah['jml'],0,',','.')."
Total Persediaan : ".number_format($ttJumlah['hp'],0,',','.')."
"); + }else{ + echo ""; + } + } + + + IF ($startDate != '' && $endDate != ''){ + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,k.ked_produk,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ, m.status + FROM barang b,no_barang n, d_pembelian d, m_pembelian m, kedalaman_produk k + WHERE n.stok > 0 + and b.id_gabungan = n.id_gabungan + and m.no_faktur = d.no_faktur + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and (b.ked_produk = k.kode_ked_produk and b.kode_strip = k.kode_strip) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_supplier = '$startDate' + and b.kode_strip = '$endDate' + GROUP BY b.id_gabungan + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + }elseif ($startDate == '' && $endDate != ''){ + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,k.ked_produk,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ, m.status + FROM barang b,no_barang n, d_pembelian d, m_pembelian m, kedalaman_produk k + WHERE n.stok > 0 + and b.id_gabungan = n.id_gabungan + and m.no_faktur = d.no_faktur + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and (b.ked_produk = k.kode_ked_produk and b.kode_strip = k.kode_strip) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_strip = '$endDate' + GROUP BY b.id_gabungan + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + }else { + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,k.ked_produk,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ, m.status + FROM barang b,no_barang n, d_pembelian d, m_pembelian m, kedalaman_produk k + WHERE n.stok > 0 + and b.id_gabungan = n.id_gabungan + and m.no_faktur = d.no_faktur + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and (b.ked_produk = k.kode_ked_produk and b.kode_strip = k.kode_strip) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_supplier = '$startDate' + GROUP BY b.id_gabungan + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + + } + $querysupp = "select nama_supplier from supplier where kd_supplier = '$startDate' "; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tahun,$bln,$strip,$kdasli,$kedproduk,$nofaktur,$kdbrg,$nmbrg,$nomor,$akhir,$pokok,$hp,$jual,$hj,$status); + $ttJumlah = array(); + $ttJumlah['jml'] = 0; + $ttJumlah['hp'] = 0; + + print("
"); + print("

Laporan Persediaan Barang Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."

"); + if($stmtsupp = mysqli_prepare($conn,$querysupp)){ + mysqli_stmt_execute($stmtsupp); + mysqli_stmt_store_result($stmtsupp); + $ceksupp = mysqli_stmt_num_rows($stmtsupp); + if($ceksupp > 0){ + mysqli_stmt_bind_result($stmtsupp,$nama); + while(mysqli_stmt_fetch($stmtsupp)){ + print("Supplier : $nama


"); + } + } + } + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['jml'] += $akhir; + $ttJumlah['hp'] += $hp; + print(" + + + "); + } + + print("
TahunBulanLini Prod.Ked Prod.Kode AsliKode BarangNama BarangNomor Brg.Stok AkhirHPHJTot.HPTot.HJStatus Brg
$tahun$bln$strip$kedproduk$kdasli$kdbrg$nmbrg$nomor$akhir".number_format($pokok,0,',','.')."".number_format($jual,0,',','.')."".number_format($hp,0,',','.')."".number_format($hj,0,',','.')."$status

"); + print("
"); + + print(""); + print(""); + + print("
Total Jumlah Barang : ".number_format($ttJumlah['jml'],0,',','.')."
Total Persediaan : ".number_format($ttJumlah['hp'],0,',','.')."
"); + }else{ + echo "Data tidak ada!"; + } + } + } +?> diff --git a/old-source/LaporanJual/lapstokps1c.php~ b/old-source/LaporanJual/lapstokps1c.php~ new file mode 100644 index 0000000..4170f2a --- /dev/null +++ b/old-source/LaporanJual/lapstokps1c.php~ @@ -0,0 +1,116 @@ +"; + echo "div#divprint{width:1024px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:950px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:80px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = $_POST['kdsupp']; + $endDate = $_POST['endDate']; + + + if(bukaKoneksi()){ + global $conn; + IF ($startDate != '' && $endDate != ''){ + + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ + FROM barang b,no_barang n, d_pembelian d + WHERE n.stok <> 0 + and b.id_gabungan = n.id_gabungan + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_supplier = '$startDate' + and b.kode_strip = '$endDate' + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + }elseif ($startDate == '' && $endDate != ''){ + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ + FROM barang b,no_barang n, d_pembelian d + WHERE n.stok <> 0 + and b.id_gabungan = n.id_gabungan + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_strip = '$endDate' + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + }else { + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ + FROM barang b,no_barang n, d_pembelian d + WHERE n.stok <> 0 + and b.id_gabungan = n.id_gabungan + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_supplier = '$startDate' + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + + } + $querysupp = "select nama_supplier from supplier where kd_supplier = '$startDate' "; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tahun,$bln,$strip,$kdasli,$nofaktur,$kdbrg,$nmbrg,$nomor,$akhir,$pokok,$hp,$jual,$hj); + $ttJumlah = array(); + $ttJumlah['jml'] = 0; + $ttJumlah['hp'] = 0; + + print("
"); + print("

Laporan Persediaan Barang Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."

"); + if($stmtsupp = mysqli_prepare($conn,$querysupp)){ + mysqli_stmt_execute($stmtsupp); + mysqli_stmt_store_result($stmtsupp); + $ceksupp = mysqli_stmt_num_rows($stmtsupp); + if($ceksupp > 0){ + mysqli_stmt_bind_result($stmtsupp,$nama); + while(mysqli_stmt_fetch($stmtsupp)){ + print("Supplier : $nama


"); + } + } + } + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['jml'] += $akhir; + $ttJumlah['hp'] += $hp; + print(""); + } + + print("
TahunBulanLini Prod.Kode AsliNo.FakturKode BarangNama BarangNomor Brg.Stok AkhirHPHJTot.HPTot.HJ
$tahun$bln$strip$kdasli$nofaktur$kdbrg$nmbrg$nomor$akhir".number_format($pokok,0,',','.')."".number_format($jual,0,',','.')."".number_format($hp,0,',','.')."".number_format($hj,0,',','.')."

"); + print("
"); + + print(""); + print(""); + + print("
Total Jumlah Barang : ".number_format($ttJumlah['jml'],0,',','.')."
Total Persediaan : ".number_format($ttJumlah['hp'],0,',','.')."
"); + }else{ + echo "Ada kolom yang kosong!"; + } + } + } +?> diff --git a/old-source/LaporanJual/laptransbrg.php b/old-source/LaporanJual/laptransbrg.php new file mode 100644 index 0000000..f8bf010 --- /dev/null +++ b/old-source/LaporanJual/laptransbrg.php @@ -0,0 +1,110 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + + if(bukaKoneksi()){ + global $conn; + $query = "SELECT m.faktur_oper,m.`tgl_transfer`, m.`toko_tujuan`,d.jml,m.total_transfer + FROM m_transfer m,(select id_transfer,sum(jumlah) jml from d_transfer group by id_transfer) as d + where m.id_transfer = d.id_transfer + and date(m.tgl_transfer) between '$startDate' and '$endDate' + and m.validasi = '1'"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$id,$tgl,$toko,$jum,$tot); + $ttJumlah = array(); + $ttJumlah['jml'] = 0; + $ttJumlah['rp'] = 0; + + print("
"); + print("

Laporan Transfer Barang Antar Toko



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['jml'] += $jum; + $ttJumlah['rp'] += $tot; + print(""); + } + + print("
No.FakturTgl TransferToko TujuanJumlah Brg.Total
$id".encTgl($tgl)."$toko$jum".number_format($tot,0,',','.')."

"); + print("
"); + + print(""); + print(""); + + print("
Total Jumlah Transfer : ".number_format($ttJumlah['jml'],0,',','.')."
Total Rp Transfer : ".number_format($ttJumlah['rp'],0,',','.')."
"); + }else{ + echo "Belum ada data transfer untuk tanggal tersebut!"; + } + } + + //laporan transfer barang kembali + $query = "SELECT m.faktur_oper,m.`tgl_kembali`, m.`toko_tujuan`,m.jml_item,m.total_transfer + FROM m_transfer_kembali m + where date(m.tgl_kembali) between '$startDate' and '$endDate' + and m.validasi = '1'"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$id,$tgl,$toko,$jum,$tot); + $ttJumlah = array(); + $ttJumlah['jml'] = 0; + $ttJumlah['rp'] = 0; + + print("
"); + print("

Laporan Transfer Barang Kembali



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['jml'] += $jum; + $ttJumlah['rp'] += $tot; + print(""); + } + + print("
No.FakturTgl KembaliToko PengirimJumlah Brg.Total
$id".encTgl($tgl)."$toko$jum".number_format($tot,0,',','.')."

"); + print("
"); + + print(""); + print(""); + + print("
Total Jumlah Transfer Kembali : ".number_format($ttJumlah['jml'],0,',','.')."
Total Rp Transfer Kembali : ".number_format($ttJumlah['rp'],0,',','.')."
"); + }else{ + echo "Belum ada data transfer kembali untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/LaporanJual/menu.php b/old-source/LaporanJual/menu.php new file mode 100644 index 0000000..3854d62 --- /dev/null +++ b/old-source/LaporanJual/menu.php @@ -0,0 +1,129 @@ + + + + + +
+ +
diff --git a/old-source/LaporanJual/pk8.php b/old-source/LaporanJual/pk8.php new file mode 100644 index 0000000..3a71c78 --- /dev/null +++ b/old-source/LaporanJual/pk8.php @@ -0,0 +1,81 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Rekap Penjualan Perbandingan Tahun Lalu +
+
+
+ + + +
Range Tanggal: s/d
+
+
+
+
+ +
+ + diff --git a/old-source/LaporanJual/prosesbawa.php b/old-source/LaporanJual/prosesbawa.php new file mode 100644 index 0000000..5e0818b --- /dev/null +++ b/old-source/LaporanJual/prosesbawa.php @@ -0,0 +1,130 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Rekap Bawa Belum Diproses +
+ + + +
+
+
+ + + +
Rentang Tanggal: -
Kode Pelanggan :
+
+
+
+
+
+ + + +
Rentang Tanggal: -
Kode Pelanggan :
+
+
+
+
+
+ + + +
Rentang Tanggal: -
Kode Pelanggan :
+
+
+
+ +
+
+ +
+
Cari Pelanggan
+
+
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+
+ +
+ +
+ + diff --git a/old-source/LaporanJual/rekapbawa.php b/old-source/LaporanJual/rekapbawa.php new file mode 100644 index 0000000..99f18de --- /dev/null +++ b/old-source/LaporanJual/rekapbawa.php @@ -0,0 +1,88 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $kodeplg = $_POST['kdplg']; + + if(bukaKoneksi()){ + global $conn; + IF (strlen($startDate) > 2 && strlen($endDate) > 2 && $kodeplg !=''){ + $query = "select m.no_nota, m.tgl_nota, m.kd_customer,p.nama, p.upline,m.jumlah_total, k.nama kasir + from m_nota_bawa m, karyawan k ,pelanggan p + where m.status_nota = 'S' + and m.kd_customer = p.kd_customer + and k.nik = m.kasir + and date(m.tgl_nota) BETWEEN '$startDate' and '$endDate' + and m.kd_customer = '$kodeplg' + order by m.tgl_nota,m.no_nota"; + }elseif ($startDate != '' && $endDate != '' && $kodeplg =='' ){ + $query = "select m.no_nota, m.tgl_nota, m.kd_customer,p.nama, p.upline,m.jumlah_total, k.nama kasir + from m_nota_bawa m, karyawan k ,pelanggan p + where m.status_nota = 'S' + and m.kd_customer = p.kd_customer + and k.nik = m.kasir + and date(m.tgl_nota) BETWEEN '$startDate' and '$endDate' + order by m.tgl_nota,m.no_nota"; + }elseif (strlen($startDate) <= 2 && strlen($endDate) <= 2 && $kodeplg !='') { + $query = "select m.no_nota, m.tgl_nota, m.kd_customer,p.nama, p.upline,m.jumlah_total, k.nama kasir + from m_nota_bawa m, karyawan k ,pelanggan p + where m.status_nota = 'S' + and m.kd_customer = p.kd_customer + and k.nik = m.kasir + and m.kd_customer = '$kodeplg' + order by m.tgl_nota,m.no_nota"; + } + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$nota,$tgl,$kdcust,$nama,$upline,$total,$kasir); + $ttJumlah = array(); + + $ttJumlah['hp'] = 0; + + print("
"); + print("

Laporan Rekap Bawa Barang



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['hp'] += $total; + print(""); + } + + print("
No.NotaTgl.NotaKd.PlgNamaUplineTotal BawaKasir
$nota$tgl$kdcust$nama$upline".number_format($total, 0, ",", ".")."$kasir

"); + print("
"); + print(""); + print("
Total Transaksi Bawa : ".number_format($ttJumlah['hp'],0,',','.')."
"); + }else{ + echo "Data tidak ditemukan!"; + } + } + } +?> + diff --git a/old-source/LaporanJual/rekapkartu.php b/old-source/LaporanJual/rekapkartu.php new file mode 100644 index 0000000..9604ea7 --- /dev/null +++ b/old-source/LaporanJual/rekapkartu.php @@ -0,0 +1,233 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $jml1 = 0; + $jml2 = 0; + $jml3 = 0; + $laci = 0; + + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Rekap kartu*/ + $query = "select m.no_nota, m.tgl_nota, m.kd_customer, m.jumlah_total, m.bank, m.no_kartu, m.no_validasi_bank, k.nama + from m_nota_tunai m, karyawan k + where m.status_bayar = 'K' + and m.no_nota_retur = '' + and m.status_nota = 'S' + and k.nik = m.kasir + and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' + order by m.tgl_nota,m.no_nota"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$nota,$tgl,$kdcust,$ttBeli,$bank,$card,$validasi,$nama); + $ttJumlah = array(); + $ttJumlah['jml1'] = 0; + $ttJumlah['rp'] = 0; + + print("
"); + print("

Rekap Transaksi Kartu



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['rp1'] += $ttBeli; + $ttJumlah['jml1']++; + print(""); + } + + print("
No.NotaTanggal NotaKode Plg.Total BelanjaBankNo.KartuNo.ValidasiKasir
$nota$tgl$kdcust".number_format($ttBeli,0,',','.')."$bank$card$validasi$nama

"); + print("
"); + print(""); + print(""); + print("
Total Lembar Nota : ".$ttJumlah['jml1']."
Total Rupiah Transaksi : ".number_format($ttJumlah['rp1'],0,',','.')."
"); + }else{ + echo "Belum ada data penjualan untuk tanggal tersebut!"; + echo "
"; + } + } + $jml1 = $ttJumlah['rp1']; + + /*----------------------------------------Rekap Retur tukar barang*/ + $query2 = "select m.no_nota,m.tgl_nota, m.kd_customer, m.jumlah_total, m.bank, m.no_kartu, + m.no_nota_retur, m.jumlah_total_retur,(jumlah_total-jumlah_total_retur) TOTAL,k.nama + from m_nota_tunai m, karyawan k + where m.status_bayar = 'K' + and m.no_nota_retur != '' + and m.status_nota = 'S' + and m.kasir = k.nik + and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' + order by m.tgl_nota,m.no_nota"; + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek = mysqli_stmt_num_rows($stmt2); + if($cek > 0){ + mysqli_stmt_bind_result($stmt2,$nota,$tgl,$kdcust,$ttBeli,$bank,$card,$notaretur,$totretur,$totalnya,$nama); + $ttJumlah = array(); + $ttJumlah['jml2'] = 0; + $ttJumlah['rp'] = 0; + + print("
"); + print("

Rekap Retur kartu



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt2)){ + $ttJumlah['rp2'] += $totalnya; + $ttJumlah['jml2']++; + print(" + "); + } + + print("
No.NotaTanggal NotaKode Plg.Total BelanjaBankNo.KartuNo.Nota ReturTot.ReturTOTAL BayarKasir
$nota$tgl$kdcust".number_format($ttBeli,0,',','.')."$bank$card$notaretur".number_format($totretur,0,',','.')."".number_format($totalnya,0,',','.')."$nama

"); + print("
"); + print(""); + print(""); + print("
Total Lembar Nota : ".$ttJumlah['jml2']."
Total Rupiah Transaksi : ".number_format($ttJumlah['rp2'],0,',','.')."
"); + }else{ + echo "Belum ada data retur transaksi kartu untuk tanggal tersebut!"; + echo "
"; + } + } + $jml2 = $ttJumlah['rp2']; + + /*----------------------------------------Rekap Retur */ + $query3 = "select distinct m.no_nota, m.tgl_nota, m.kd_customer, m.jumlah_total, k.nama + from m_nota_retur m, karyawan k,d_nota_retur d,m_nota_tunai mt + where m.kasir = k.nik + and d.no_nota = m.no_nota + and d.no_nota_tunai = mt.no_nota + and mt.status_bayar = 'K' + and (m.status_nota = 'K' or m.status_nota = 'D') + and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' + order by m.tgl_nota,m.no_nota"; + if($stmt3 = mysqli_prepare($conn,$query3)){ + mysqli_stmt_execute($stmt3); + mysqli_stmt_store_result($stmt3); + $cek = mysqli_stmt_num_rows($stmt3); + if($cek > 0){ + mysqli_stmt_bind_result($stmt3,$nota,$tgl,$kdcust,$ttBeli,$nama); + $ttJumlah = array(); + $ttJumlah['jml3'] = 0; + $ttJumlah['rp'] = 0; + + print("
"); + print("

Rekap Retur



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt3)){ + $ttJumlah['rp3'] += $ttBeli; + $ttJumlah['jml3']++; + print(""); + } + + print("
No.NotaTanggal NotaKode Plg.Total BelanjaKasir
$nota$tgl$kdcust".number_format($ttBeli,0,',','.')."$nama

"); + print("
"); + print(""); + print(""); + print("
Total Lembar Nota : ".$ttJumlah['jml3']."
Total Rupiah Transaksi : ".number_format($ttJumlah['rp3'],0,',','.')."
"); + }else{ + echo "Belum ada data retur barang untuk tanggal tersebut!"; + echo "
"; + } + } + $jml3 = $ttJumlah['rp3']; + + /*----------------------------------------Rekap bank ----------------------------------------- */ + $query4 = "select temp.bank,sum(temp.TOTAL) from + (select m.bank,sum(jumlah_total) TOTAL + from m_nota_tunai m + where m.status_bayar = 'K' + and m.no_nota_retur = '' + and m.status_nota = 'S' + and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' + group by m.bank + UNION ALL + select m.bank,sum((jumlah_total-jumlah_total_retur)) TOTAL + from m_nota_tunai m, karyawan k + where m.status_bayar = 'K' + and m.no_nota_retur != '' + and m.status_nota = 'S' + and m.kasir = k.nik + and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' + group by m.bank) temp + group by temp.bank"; + + if($stmt4 = mysqli_prepare($conn,$query4)){ + mysqli_stmt_execute($stmt4); + mysqli_stmt_store_result($stmt4); + $cek = mysqli_stmt_num_rows($stmt4); + if($cek > 0){ + mysqli_stmt_bind_result($stmt4,$bank,$tot); + $ttJumlah = array(); + $ttJumlah['rp'] = 0; + + print("
"); + print("

Rekap Transaksi Kartu



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt4)){ + $ttJumlah['rp4'] += $tot; + print(""); + } + + print("
BankTOTAL
$bank".number_format($tot,0,',','.')."

"); + print("
"); + print(""); + print("
Total Rupiah Transaksi : ".number_format($ttJumlah['rp4'],0,',','.')."
"); + }else{ + echo "Belum ada data penjualan untuk tanggal tersebut!"; + echo "
"; + } + } + + $laci = $jml1 + $jml2 - $jml3; + print("

"); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print("
Total Transaksi Kartu:".number_format($jml1,0,',','.')."
Total Retur Transaksi Kartu:".number_format($jml2,0,',','.')."
_______________________________(+)
Total Retur:".number_format($jml3,0,',','.')."
_______________________________(-)
Total Transaksi:".number_format($laci,0,',','.')."
"); + print("


"); + } +?> diff --git a/old-source/LaporanJual/rekapprosesbawa.php b/old-source/LaporanJual/rekapprosesbawa.php new file mode 100644 index 0000000..6156542 --- /dev/null +++ b/old-source/LaporanJual/rekapprosesbawa.php @@ -0,0 +1,98 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $kodeplg = $_POST['kdplg']; + + if(bukaKoneksi()){ + global $conn; + IF (strlen($startDate) > 2 && strlen($endDate) > 2 && $kodeplg !=''){ + $query = "SELECT ((year(curdate()) - b.tahun) * 12) + month(curdate()) - b.bulan usia,DATEDIFF( CURDATE( ) , DATE( m.tgl_nota ) ) lama_bawa, p.nama, d.no_nota, m.tgl_nota, d.kd_barang, b.nama_barang, d.no_barang, SUM( d.jumlah ) , SUM( d.jumlah * d.harga_satuan ) rp, SUM( d.jumlah * REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( n.harga_pokok, 'B', '1' ) , 'R', '2' ) , 'A', '3' ) , 'W', '4' ) , 'N', '5' ) , 'F', '6' ) , 'O', '7' ) , 'X', '8' ) , 'E', '9' ) , 'S', '0' ) ) hp + FROM d_nota_bawa d, m_nota_bawa m, pelanggan p, barang b, no_barang n + WHERE d.`status_barang` IS NULL + AND m.no_nota = d.no_nota + AND b.id_gabungan = n.id_gabungan + AND m.kd_customer = p.kd_customer + AND (d.kd_barang = b.kode_barang AND d.no_barang = n.nomor) + AND DATE( m.tgl_nota ) + BETWEEN '$startDate' and '$endDate' + AND m.kd_customer = '$kodeplg' + GROUP BY CONCAT( d.kd_barang, d.no_barang ) , d.no_nota + ORDER BY DATE( tgl_nota ) , d.no_nota, p.nama"; + }elseif ($startDate != '' && $endDate != '' && $kodeplg =='' ){ + $query = "SELECT ((year(curdate()) - b.tahun) * 12) + month(curdate()) - b.bulan usia,DATEDIFF( CURDATE( ) , DATE( m.tgl_nota ) ) lama_bawa, p.nama, d.no_nota, m.tgl_nota, d.kd_barang, b.nama_barang, d.no_barang, SUM( d.jumlah ) , SUM( d.jumlah * d.harga_satuan ) rp, SUM( d.jumlah * REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( n.harga_pokok, 'B', '1' ) , 'R', '2' ) , 'A', '3' ) , 'W', '4' ) , 'N', '5' ) , 'F', '6' ) , 'O', '7' ) , 'X', '8' ) , 'E', '9' ) , 'S', '0' ) ) hp + FROM d_nota_bawa d, m_nota_bawa m, pelanggan p, barang b, no_barang n + WHERE d.`status_barang` IS NULL + AND m.no_nota = d.no_nota + AND b.id_gabungan = n.id_gabungan + AND m.kd_customer = p.kd_customer + AND (d.kd_barang = b.kode_barang AND d.no_barang = n.nomor) + AND DATE( m.tgl_nota ) + BETWEEN '$startDate' and '$endDate' + GROUP BY CONCAT( d.kd_barang, d.no_barang ) , d.no_nota + ORDER BY DATE( tgl_nota ) , d.no_nota, p.nama"; + }elseif (strlen($startDate) <= 2 && strlen($endDate) <= 2 && $kodeplg !='') { + $query = "SELECT ((year(curdate()) - b.tahun) * 12) + month(curdate()) - b.bulan usia,DATEDIFF( CURDATE( ) , DATE( m.tgl_nota ) ) lama_bawa, p.nama, d.no_nota, m.tgl_nota, d.kd_barang, b.nama_barang, d.no_barang, SUM( d.jumlah ) , SUM( d.jumlah * d.harga_satuan ) rp, SUM( d.jumlah * REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( n.harga_pokok, 'B', '1' ) , 'R', '2' ) , 'A', '3' ) , 'W', '4' ) , 'N', '5' ) , 'F', '6' ) , 'O', '7' ) , 'X', '8' ) , 'E', '9' ) , 'S', '0' ) ) hp + FROM d_nota_bawa d, m_nota_bawa m, pelanggan p, barang b, no_barang n + WHERE d.`status_barang` IS NULL + AND m.no_nota = d.no_nota + AND b.id_gabungan = n.id_gabungan + AND m.kd_customer = p.kd_customer + AND (d.kd_barang = b.kode_barang AND d.no_barang = n.nomor) + AND m.kd_customer = '$kodeplg' + GROUP BY CONCAT( d.kd_barang, d.no_barang ) , d.no_nota + ORDER BY DATE( tgl_nota ) , d.no_nota, p.nama"; + } + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$usia,$lama,$nama,$nota,$tgl,$brg,$nmbrg,$nobrg,$jml,$rp,$hp); + + print("
"); + print("

Rekap Bawa Barang yang Belum Diproses



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $tthargapokok += $hp; + print(""); + } + + print("
Lama Bawa (hari)NamaNo.NotaTgl.NotaKode BarangNama BarangNo.BarangJumlahHPHJUsia Brg (bln)
$lama$nama$nota$tgl$brg$nmbrg$nobrg$jml".number_format($hp, 0, ",", ".")."".number_format($rp, 0, ",", ".")."$usia

"); + print(""); + print(""); + print("
Total Harga Pokok : ".number_format($tthargapokok, 0, ",", ".")."
"); + print("
"); + + }else{ + echo "Data tidak ditemukan!"; + } + } + } +?> + diff --git a/old-source/LaporanJual/rekaptunai.php b/old-source/LaporanJual/rekaptunai.php new file mode 100644 index 0000000..53a8a83 --- /dev/null +++ b/old-source/LaporanJual/rekaptunai.php @@ -0,0 +1,230 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + $jml1 = 0; + $jml2 = 0; + $jml3 = 0; + $laci = 0; + + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Rekap Tunai*/ + $query = "select m.no_nota,m.tgl_nota, m.kd_customer, m.jumlah_total, k.nama + FROM m_nota_tunai m, karyawan k + where m.status_bayar = 'T' + and m.status_nota = 'S' + and m.no_nota_retur = '' + and k.nik = m.kasir + and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' + order by m.no_nota"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$nota,$tgl,$kdcust,$ttBeli,$nama); + $ttJumlah = array(); + $ttJumlah['jml1'] = 0; + $ttJumlah['rp1'] = 0; + + print("
"); + print("

Rekap Transaksi Tunai



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['rp1'] += $ttBeli; + $ttJumlah['jml1']++; + print(""); + } + + print("
No.NotaTanggal NotaKode Plg.Total BelanjaKasir
$nota$tgl$kdcust".number_format($ttBeli,0,',','.')."$nama

"); + print("
"); + print(""); + print(""); + print("
Total Lembar Nota : ".$ttJumlah['jml1']."
Total Rupiah Transaksi : ".number_format($ttJumlah['rp1'],0,',','.')."
"); + }else{ + echo "Belum ada data penjualan untuk tanggal tersebut!"; + echo "
"; + } + } + $jml1 = $ttJumlah['rp1']; + + /*----------------------------------------Rekap Retur tukar barang---------------*/ + $query2 = "select m.no_nota,m.tgl_nota, m.kd_customer, m.jumlah_total, + m.no_nota_retur, m.jumlah_total_retur,(jumlah_total-jumlah_total_retur) TOTAL,k.nama + from m_nota_tunai m, karyawan k + where m.status_bayar = 'T' + and m.no_nota_retur != '' + and m.status_nota = 'S' + and m.kasir = k.nik + and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' + order by m.no_nota"; + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek = mysqli_stmt_num_rows($stmt2); + if($cek > 0){ + mysqli_stmt_bind_result($stmt2,$nota,$tgl,$kdcust,$ttBeli,$notaretur,$totretur,$totalnya,$nama); + $ttJumlah = array(); + $ttJumlah['jml2'] = 0; + $ttJumlah['rp2'] = 0; + + print("
"); + print("

Rekap Retur Tunai



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt2)){ + $ttJumlah['rp2'] += $totalnya; + $ttJumlah['jml2']++; + print(" + "); + } + + print("
No.NotaTanggal NotaKode Plg.Total BelanjaNo.Nota ReturTot.ReturTOTAL BayarKasir
$nota$tgl$kdcust".number_format($ttBeli,0,',','.')."$notaretur".number_format($totretur,0,',','.')."".number_format($totalnya,0,',','.')."$nama

"); + print("
"); + print(""); + print(""); + print("
Total Lembar Nota : ".$ttJumlah['jml2']."
Total Rupiah Transaksi : ".number_format($ttJumlah['rp2'],0,',','.')."
"); + }else{ + echo "Belum ada data retur tunai untuk tanggal tersebut!"; + echo "
"; + } + } + $jml2 = $ttJumlah['rp2']; + + /*----------------------------------------Rekap Retur */ + $query3 = "select distinct m.no_nota, m.tgl_nota, m.kd_customer, m.jumlah_total, k.nama + from m_nota_retur m, karyawan k,d_nota_retur d,m_nota_tunai mt + where m.kasir = k.nik + and d.no_nota = m.no_nota + and d.no_nota_tunai = mt.no_nota + and mt.status_bayar = 'T' + and (m.status_nota = 'K' or m.status_nota = 'D') + and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' + order by m.no_nota"; + if($stmt3 = mysqli_prepare($conn,$query3)){ + mysqli_stmt_execute($stmt3); + mysqli_stmt_store_result($stmt3); + $cek = mysqli_stmt_num_rows($stmt3); + if($cek > 0){ + mysqli_stmt_bind_result($stmt3,$nota,$tgl,$kdcust,$ttBeli,$nama); + $ttJumlah = array(); + $ttJumlah['jml3'] = 0; + $ttJumlah['rp3'] = 0; + + print("
"); + print("

Rekap Retur



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt3)){ + $ttJumlah['rp3'] += $ttBeli; + $ttJumlah['jml3']++; + print(""); + } + + print("
No.NotaTanggal NotaKode Plg.Total BelanjaKasir
$nota$tgl$kdcust".number_format($ttBeli,0,',','.')."$nama

"); + print("
"); + print(""); + print(""); + print("
Total Lembar Nota : ".$ttJumlah['jml3']."
Total Rupiah Transaksi : ".number_format($ttJumlah['rp3'],0,',','.')."
"); + }else{ + echo "Belum ada data retur barang untuk tanggal tersebut!"; + echo "
"; + } + } + $jml3 = $ttJumlah['rp3']; + + /*----------------------------------------Rekap TITIPAN */ + $query4 = "select sum(t.bayar_bon) + from bayar_bon t + where date(t.tgl_byr) between '$startDate' AND '$endDate'"; + if($stmt4 = mysqli_prepare($conn,$query4)){ + mysqli_stmt_execute($stmt4); + mysqli_stmt_store_result($stmt4); + $cek = mysqli_stmt_num_rows($stmt4); + if($cek > 0){ + mysqli_stmt_bind_result($stmt4,$total); + $ttJumlah = array(); + $ttJumlah['rp4'] = 0; + + while(mysqli_stmt_fetch($stmt4)){ + $ttJumlah['rp4'] += $total; + } + }else{ + echo "Belum ada data titipan untuk tanggal tersebut!"; + echo "
"; + } + } + $jml4 = $ttJumlah['rp4']; + + /*----------------------------------------Rekap Komisi */ + $query5 = "select sum(k.jumlah) + from komisi k + where date(k.tgl_ambil) between '$startDate' AND '$endDate'"; + if($stmt5 = mysqli_prepare($conn,$query5)){ + mysqli_stmt_execute($stmt5); + mysqli_stmt_store_result($stmt5); + $cek = mysqli_stmt_num_rows($stmt5); + if($cek > 0){ + mysqli_stmt_bind_result($stmt5,$total1); + $ttJumlah = array(); + $ttJumlah['rp5'] = 0; + + while(mysqli_stmt_fetch($stmt5)){ + $ttJumlah['rp5'] += $total1; + } + }else{ + echo "Belum ada data komisi untuk tanggal tersebut!"; + echo "
"; + } + } + $jml5 = $ttJumlah['rp5']; + + $laci = $jml1 + $jml2 + $jml4 - $jml3 - $jml5; + print("

"); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print("
Total Transaksi Tunai:".number_format($jml1,0,',','.')."
Total Retur Tunai:".number_format($jml2,0,',','.')."
Total Titipan:".number_format($jml4,0,',','.')."
_____________________________(+)
Total Retur:".number_format($jml3,0,',','.')."
Total Komisi:".number_format($jml5,0,',','.')."
_____________________________(-)
Total Uang Laci:".number_format($laci,0,',','.')."
"); + print("


"); + } +?> diff --git a/old-source/LaporanJual/returkonsinyasi.php b/old-source/LaporanJual/returkonsinyasi.php new file mode 100644 index 0000000..4a9d4bf --- /dev/null +++ b/old-source/LaporanJual/returkonsinyasi.php @@ -0,0 +1,83 @@ +"; + echo "div#divprint{width:950px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:900px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate3']); + $endDate = decTgl($_POST['endDate3']); + + if(bukaKoneksi()){ + global $conn; + + $query = "select d.no_nota, m.tgl_nota, m.kd_customer, m.status_nota, + d.kd_barang,d.no_barang,dp.nm_brg,sum(d.jumlah), + sum(d.jumlah*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp, + sum(d.jumlah*d.harga_jual) hj,m.keterangan,d.kode_pram + from m_nota_retur m,d_nota_retur d,no_barang n, barang b, d_pembelian dp, m_pembelian mp + where b.id_gabungan = n.id_gabungan + and m.no_nota = d.no_nota + and dp.no_faktur = mp.no_faktur + AND left(mp.no_faktur,4) <> 'RVB-' + AND mp.status = 'K' + AND mp.validasi = '1' + AND (dp.kode_barang = d.kd_barang AND dp.nomor = d.no_barang) + and (d.kd_barang = b.kode_barang and d.no_barang = n.nomor) + and date(m.tgl_nota) BETWEEN '$startDate' and '$endDate' + group by m.no_nota,concat(d.kd_barang,d.no_barang) + order by m.tgl_nota,m.no_nota"; + + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$nota,$tgl,$kdcust,$status,$kdbrg,$nomor,$namabrg,$jumlah,$hp,$hj,$ket,$kasir); + $ttJumlah = array(); + + $ttJumlah['hp'] = 0; + $ttJumlah['hj'] = 0; + print("
"); + print("

Laporan Rekap Retur Barang Konsinyasi



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['hp'] += $hp; + $ttJumlah['hj'] += $hj; + print(" + + "); + } + + print("
No.NotaTgl.NotaKd.PlgStatus NotaKd.BarangNomorNama BrgJumlahHPHJKeteranganKasir
$nota$tgl$kdcust$status$kdbrg$nomor$namabrg$jumlah".number_format($hp, 0, ",", ".")."".number_format($hj, 0, ",", ".")."$ket$kasir

"); + print("
"); + print(""); + print(""); + print("
Total Harga Pokok : ".number_format($ttJumlah['hp'],0,',','.')."
Total Harga Jual : ".number_format($ttJumlah['hj'],0,',','.')."
"); + }else{ + echo "Data tidak ditemukan!"; + } + } + } +?> + diff --git a/old-source/LaporanJual/rincian_jual.php b/old-source/LaporanJual/rincian_jual.php new file mode 100644 index 0000000..f099706 --- /dev/null +++ b/old-source/LaporanJual/rincian_jual.php @@ -0,0 +1,289 @@ +"; + echo "table.tbl {width:750px;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $nonota = $_GET['nota']; + if(substr($_GET['nota'],0,2) == 'B-'): + $nonotabon = $nonota; + bon($nonotabon); + elseif(substr($_GET['nota'],0,2) == 'W-'): + $nonotabawa = $nonota; + bawa($nonotabawa); + elseif(substr($_GET['nota'],0,2) == 'R-'): + $nonotaretur = $nonota; + retur($nonotaretur); + else: + $nonotatunai = $nonota; + tunai($nonotatunai); + endif; + +function bon($nonotabon) +{ + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Rekap Bon*/ + $query = "SELECT d.`kd_brg`, d.`nomor`, b.nama_barang,d.`jumlah`, d.`diskon`, + d.`hrg_satuan`,(d.`hrg_satuan`*d.`jumlah`) subtotal,d.`kd_pram` + FROM d_bon d,barang b + where d.`kd_brg`=b.kode_barang + and d.no_bon = '$nonotabon'"; + $query2 = "select m.no_bon,m.tgl_bon,m.kode_plg, + m.jumlah_total,m.diskon, + m.bank,m.no_kartu,m.kasir + from m_bon m + where m.no_bon = '$nonotabon'"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdbrg,$nomor,$nmbrg,$jum,$diskon,$hj,$subtotal,$kdpram); + + print("
"); + print("

Rincian Penjualan


"); + print("

"); + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$nota,$tglnota,$kdcust,$tot,$disc,$bank,$kartu,$kasir); + while(mysqli_stmt_fetch($stmt2)){ + print("Nomor Nota : ".$nota."
"); + print("Tanggal Nota : ".$tglnota."
"); + print("Plg : ".$kdcust."
"); + print("Total : ".number_format($tot,0,',','.')."
"); + print("Jumlah uang : ".number_format($totuang,0,',','.')."
"); + print("Discount : ".$disc."
"); + print("Bank : ".$bank."
"); + print("No.kartu : ".$kartu."
"); + print("Kasir : ".$kasir."

"); + } + } + } + + + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + print(""); + } + + print("
Kode Brg.NomorNamaJumlDiscHJSub TotalKd Pram
$kdbrg$nomor$nmbrg$jum".$diskon."".number_format($hj,0,',','.')."".number_format($subtotal,0,',','.')."$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + print("

"); + } +} + +function bawa($nonotabawa) +{ + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Rekap Bawa*/ + $query = "SELECT d.`kd_barang`, d.`no_barang`, b.nama_barang,d.`jumlah`, + d.`harga_satuan`,(d.`harga_satuan`*d.`jumlah`) subtotal,d.`kode_pram` + FROM d_nota_bawa d,barang b + where d.`kd_barang`=b.kode_barang + and d.no_nota = '$nonotabawa'"; + $query2 = "select m.no_nota,m.tgl_nota,m.kd_customer, + m.jumlah_total,m.kasir + from m_nota_bawa m + where m.no_nota = '$nonotabawa'"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdbrg,$nomor,$nmbrg,$jum,$hj,$subtotal,$kdpram); + + print("
"); + print("

Rincian Penjualan


"); + print("

"); + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$nota,$tglnota,$kdcust,$tot,$kasir); + while(mysqli_stmt_fetch($stmt2)){ + print("Nomor Nota : ".$nota."
"); + print("Tanggal Nota : ".$tglnota."
"); + print("Plg : ".$kdcust."
"); + print("Total : ".number_format($tot,0,',','.')."
"); + print("Kasir : ".$kasir."

"); + } + } + } + + + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + print(""); + } + + print("
Kode Brg.NomorNamaJumlHJSub TotalKd Pram
$kdbrg$nomor$nmbrg$jum".number_format($hj,0,',','.')."".number_format($subtotal,0,',','.')."$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + print("

"); + } +} + +function retur($nonotaretur) +{ + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Rekap Tunai*/ + $query = "SELECT d.`kd_barang`, d.`no_barang`, b.nama_barang,d.`jumlah`, d.`diskon`, + d.`harga_jual`,(d.`harga_jual`*d.`jumlah`) subtotal,d.no_nota_tunai,d.`kode_pram` + FROM d_nota_retur d,barang b + where d.`kd_barang`=b.kode_barang + and d.no_nota = '$nonotaretur'"; + $query2 = "select m.no_nota,m.tgl_nota,m.kd_customer, + m.jumlah_total,m.total_diskon,m.keterangan,m.kasir + from m_nota_retur m + where m.no_nota = '$nonotaretur'"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdbrg,$nomor,$nmbrg,$jum,$diskon,$hj,$subtotal,$notatunai,$kdpram); + + print("
"); + print("

Rincian Penjualan


"); + print("

"); + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$nota,$tglnota,$kdcust,$tot,$disc,$keterangan,$kasir); + while(mysqli_stmt_fetch($stmt2)){ + print("Nomor Nota : ".$nota."
"); + print("Tanggal Nota : ".$tglnota."
"); + print("Plg : ".$kdcust."
"); + print("Total : ".number_format($tot,0,',','.')."
"); + print("Keterangan : ".$keterangan."
"); + print("Kasir : ".$kasir."

"); + } + } + } + + + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + print(""); + } + + print("
Kode Brg.NomorNamaJumlDiscHJSub TotalNota tunaiKd Pram
$kdbrg$nomor$nmbrg$jum".$diskon."".number_format($hj,0,',','.')."".number_format($subtotal,0,',','.')."$notatunai$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + print("

"); + } +} + +function tunai($nonotatunai) +{ + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Rekap Tunai*/ + $query = "SELECT d.`kd_barang`, d.`no_barang`, b.nama_barang,d.`jumlah`, d.`diskon`, + d.`harga_jual`,(d.`harga_jual`*d.`jumlah`) subtotal,d.`kode_pram` + FROM d_nota_tunai d,barang b + where d.`kd_barang`=b.kode_barang + and d.no_nota = '$nonotatunai'"; + $query2 = "select m.no_nota,m.tgl_nota,m.kd_customer, + m.jumlah_total,m.total_uang,m.total_diskon, + m.bank,m.no_kartu,m.kasir + from m_nota_tunai m + where m.no_nota = '$nonotatunai'"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdbrg,$nomor,$nmbrg,$jum,$diskon,$hj,$subtotal,$kdpram); + + print("
"); + print("

Rincian Penjualan


"); + print("

"); + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$nota,$tglnota,$kdcust,$tot,$totuang,$disc,$bank,$kartu,$kasir); + while(mysqli_stmt_fetch($stmt2)){ + print("Nomor Nota : ".$nota."
"); + print("Tanggal Nota : ".$tglnota."
"); + print("Plg : ".$kdcust."
"); + print("Total : ".number_format($tot,0,',','.')."
"); + print("Jumlah uang : ".number_format($totuang,0,',','.')."
"); + print("Discount : ".$disc."
"); + print("Bank : ".$bank."
"); + print("No.kartu : ".$kartu."
"); + print("Kasir : ".$kasir."

"); + } + } + } + + + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + print(""); + } + + print("
Kode Brg.NomorNamaJumlDiscHJSub TotalKd Pram
$kdbrg$nomor$nmbrg$jum".$diskon."".number_format($hj,0,',','.')."".number_format($subtotal,0,',','.')."$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + print("

"); + } +} + +?> diff --git a/old-source/LaporanJual/rincibeli.php b/old-source/LaporanJual/rincibeli.php new file mode 100644 index 0000000..a2cb6d2 --- /dev/null +++ b/old-source/LaporanJual/rincibeli.php @@ -0,0 +1,73 @@ +"; + echo "table.tbl {width:950px;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:100px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $tgl = left($_GET['tgllini'],10); + $lini = right($_GET['tgllini'],2); + + + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Pembelian Rinci*/ + $query = "SELECT m.tgl_masuk,m.tgl_nota,m.no_faktur,s.nama_supplier,d.kode_barang,d.nm_brg,d.nomor,d.jum_fisik, + (d.jum_fisik*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp, + (d.jum_fisik*d.harga_satuan) hj,m.keterangan + FROM m_pembelian m, d_pembelian d, supplier s, barang b + WHERE s.kd_supplier = m.kd_supplier + AND d.kode_barang = b.kode_barang + AND m.no_faktur = d.no_faktur + AND m.validasi = '1' + AND m.status_revisi = '1' + AND b.kode_strip = '$lini' + AND m.tgl_masuk = '$tgl' + ORDER BY d.id"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tglmsk,$tglnota,$nota,$supp,$kdbrg,$nmbrg,$no,$jml,$hp,$hj,$ktr); + + print("
"); + print("

Rekap Transaksi Pembelian



"); + print("

"); + print(""); + print(" + "); + + $ttHP = 0; + $ttHJ = 0; + while(mysqli_stmt_fetch($stmt)){ + $ttHP += $hp; + $ttHJ += $hj; + print(" + + "); + } + print(""); + print("
Tgl MasukTgl NotaNo.FakturSupplierKode Brg.Nama Brg.NomorJumlHPHJKeterangan
$tglmsk$tglnota$nota$supp$kdbrg$nmbrg$no$jml".number_format($hp,0,',','.')."".number_format($hj,0,',','.')."$ktr
Total HP Beli".number_format($ttHP,0,',','.')."".number_format($ttHJ,0,',','.')."

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + print("

"); + } + +?> diff --git a/old-source/LaporanJual/rincijual.php b/old-source/LaporanJual/rincijual.php new file mode 100644 index 0000000..9e74b71 --- /dev/null +++ b/old-source/LaporanJual/rincijual.php @@ -0,0 +1,139 @@ +"; + echo "table.tbl {width:950px;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:100px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $tanggal = left($_GET['tgllini'],10); + $lini = right($_GET['tgllini'],2); + + + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Rekap Tunai*/ + $query = "SELECT m.tgl_nota,d.no_nota,d.kd_barang,b.nama_barang,d.no_barang,d.jumlah,d.diskon, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + d.harga_jual, + d.kode_pram + from m_nota_tunai m, d_nota_tunai d, barang b + where m.no_nota = d.no_nota + and d.kd_barang = b.kode_barang + and b.kode_strip = '$lini' + and date(m.tgl_nota) = '$tanggal' + order by d.no_nota"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tgl,$nota,$kdbrg,$nmbrg,$no,$jml,$disc,$hp,$hj,$kdpram); + + print("
"); + print("

Rekap Transaksi Tunai



"); + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + print(" + + "); + } + + print("
Tanggal NotaNo.NotaKode Brg.Nama Brg.NomorJumlDiscHPHJKd Pram
$tgl$nota$kdbrg$nmbrg$no$jml$disc".number_format($hp,0,',','.')."".number_format($hj,0,',','.')."$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + /*----------------------------------------Rekap BON*/ + $query2 = "SELECT m.tgl_bon,d.no_bon,d.kd_brg,b.nama_barang,d.nomor,d.jumlah,d.diskon, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + d.hrg_satuan, + d.kd_pram + from m_bon m, d_bon d, barang b + where m.no_bon = d.no_bon + and d.kd_brg = b.kode_barang + and b.kode_strip = '$lini' + and date(m.tgl_bon) = '$tanggal' + order by d.no_bon"; + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$tgl,$nota,$kdbrg,$nmbrg,$no,$jml,$disc,$hp,$hj,$kdpram); + + print("
"); + print("

Rekap Transaksi BON



"); + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt2)){ + print(" + + "); + } + + print("
Tanggal NotaNo.NotaKode Brg.Nama Brg.NomorJumlDiscHPHJKd Pram
$tgl$nota$kdbrg$nmbrg$no$jml$disc".number_format($hp,0,',','.')."".number_format($hj,0,',','.')."$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + /*----------------------------------------Rekap retur */ + $query4 = "SELECT m.tgl_nota,d.no_nota,d.kd_barang,b.nama_barang,s.nama_supplier,d.no_barang,d.jumlah,d.diskon,d.harga_jual,d.harga_pokok,d.kode_pram + FROM d_nota_retur d,barang b,m_nota_retur m, supplier s + WHERE d.kd_barang = b.kode_barang + and d.no_nota = m.no_nota + and b.kode_supplier = s.kd_supplier + and (m.status_nota = 'T' or m.status_nota = 'K' or m.status_nota = 'D') + and b.kode_strip = '$lini' + and date(m.tgl_nota) = '$tanggal' + order by m.tgl_nota"; + if($stmt4 = mysqli_prepare($conn,$query4)){ + mysqli_stmt_execute($stmt4); + mysqli_stmt_store_result($stmt4); + $cek = mysqli_stmt_num_rows($stmt4); + if($cek > 0){ + mysqli_stmt_bind_result($stmt4,$tgl,$nota,$kdbrg,$nmbrg,$kdlama,$no,$jml,$disc,$hj,$hp,$kdpram); + + print("
"); + print("

Rekap Transaksi Retur



"); + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt4)){ + print(""); + } + + print("
Tanggal NotaNo.NotaKode Brg.Nama Brg.Kode LamaNomorJumlDiscHJHPKd Pram
$tgl$nota$kdbrg$nmbrg$kdlama$no$jml$disc".number_format($hj,0,',','.')."$hp$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + print("

"); + } + +?> diff --git a/old-source/LaporanJual/rincirekapbawa.php b/old-source/LaporanJual/rincirekapbawa.php new file mode 100644 index 0000000..5e4dd88 --- /dev/null +++ b/old-source/LaporanJual/rincirekapbawa.php @@ -0,0 +1,69 @@ +"; + echo "table.tbl {width:950px;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:100px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $tgl = left($_GET['tgllini'],10); + $lini = right($_GET['tgllini'],2); + + + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Rekap Bawa*/ + $query = "select m.tgl_nota,d.no_nota,d.kd_barang,b.nama_barang,d.no_barang,sum(d.jumlah), + sum(d.jumlah*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp, + sum(d.jumlah*d.harga_satuan) hj, + d.kode_pram + from m_nota_bawa m,d_nota_bawa d,no_barang n, barang b + where m.status_nota = 'S' + and m.no_nota = d.no_nota + and b.id_gabungan = n.id_gabungan + and (d.kd_barang = b.kode_barang and d.no_barang = n.nomor) + and b.kode_strip = '$lini' + and date(m.tgl_nota) = '$tgl' + group by m.no_nota,concat(d.kd_barang,d.no_barang) + order by m.tgl_nota,m.no_nota"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tgl,$nota,$kdbrg,$nmbrg,$no,$jml,$hp,$hj,$kdpram); + + print("
"); + print("

Rekap Transaksi Bawa



"); + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + print(" + + "); + } + + print("
Tanggal NotaNo.NotaKode Brg.Nama Brg.NomorJumlHPHJKd Pram
$tgl$nota$kdbrg$nmbrg$no$jml".number_format($hp,0,',','.')."".number_format($hj,0,',','.')."$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + print("

"); + } + +?> diff --git a/old-source/LaporanJual/rinciretur.php b/old-source/LaporanJual/rinciretur.php new file mode 100644 index 0000000..1cb6332 --- /dev/null +++ b/old-source/LaporanJual/rinciretur.php @@ -0,0 +1,69 @@ +"; + echo "table.tbl {width:950px;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:100px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $tgl = left($_GET['tgllini'],10); + $lini = right($_GET['tgllini'],2); + + + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Retur Pembelian rinci*/ + $query = "select r.`tgl_retur`,r.`no_nota`,s.nama_supplier,d.kd_barang,b.nama_barang,d.nomor_barang,d.jumlah,SUM(d.jumlah*d.harga_satuan) hp,r.`keterangan` + from m_retur_beli r,d_retur_beli d,supplier s, barang b + where + d.kd_barang = b.kode_barang + and r.kd_supplier = s.kd_supplier + and r.id_retur = d.id_retur + and r.validasi = '1' + and r.tgl_retur = '$tgl' + and b.kode_strip = '$lini' + GROUP BY r.`no_nota`,concat(d.kd_barang,d.nomor_barang)"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tglnota,$nota,$supp,$kdbrg,$nmbrg,$no,$jml,$hp,$ktr); + + print("
"); + print("

Rekap Retur Pembelian



"); + print("

"); + print(""); + print(" + "); + + $ttHP = 0; + while(mysqli_stmt_fetch($stmt)){ + $ttHP += $hp; + print(" + + "); + } + print(""); + print("
Tgl NotaNo.FakturSupplierKode Brg.Nama Brg.NomorJumlHPKeterangan
$tglnota$nota$supp$kdbrg$nmbrg$no$jml".number_format($hp,0,',','.')."$ktr
Total HP".number_format($ttHP,0,',','.')."

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + print("

"); + } + +?> diff --git a/old-source/LaporanJual/rincirevisi.php b/old-source/LaporanJual/rincirevisi.php new file mode 100644 index 0000000..68ebc38 --- /dev/null +++ b/old-source/LaporanJual/rincirevisi.php @@ -0,0 +1,75 @@ +"; + echo "table.tbl {width:1024px;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:100px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $tgl = left($_GET['tgllini'],10); + $lini = right($_GET['tgllini'],2); + + + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Revisi Rinci*/ + $query = "SELECT m.tgl_masuk,m.tgl_nota,m.no_faktur,s.nama_supplier,d.kode_barang,d.nm_brg,d.nomor,SUM(d.jum_fisik) jml, + SUM(d.jum_fisik*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hp, + SUM(d.jum_fisik*d.harga_satuan) hj,m.keterangan + FROM m_pembelian m, d_pembelian d, supplier s, barang b + WHERE s.kd_supplier = m.kd_supplier + AND d.kode_barang = b.kode_barang + AND m.no_faktur = d.no_faktur + AND m.validasi = '1' + AND left(m.no_faktur,4) = 'RVB-' + AND m.status_revisi = 0 + AND m.tgl_masuk = '$tgl' + AND b.kode_strip = '$lini' + GROUP BY m.no_faktur,concat(d.kode_barang,d.nomor) + ORDER BY d.id"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tglmsk,$tglnota,$nota,$supp,$kdbrg,$nmbrg,$no,$jml,$hp,$hj,$ktr); + + print("
"); + print("

Rekap Revisi



"); + print("

"); + print(""); + print(" + "); + + $ttHP = 0; + $ttHJ = 0; + while(mysqli_stmt_fetch($stmt)){ + $ttHP += $hp; + $ttHJ += $hj; + print(" + + "); + } + print(""); + print("
Tgl MasukTgl NotaNo.FakturSupplierKode Brg.Nama Brg.NomorJumlHPHJKeterangan
$tglmsk$tglnota$nota$supp$kdbrg$nmbrg$no$jml".number_format($hp,0,',','.')."".number_format($hj,0,',','.')."$ktr
Total HP".number_format($ttHP,0,',','.')."".number_format($ttHJ,0,',','.')."

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + print("

"); + } + +?> diff --git a/old-source/LaporanJual/rincistockopname.php b/old-source/LaporanJual/rincistockopname.php new file mode 100644 index 0000000..66e9b3b --- /dev/null +++ b/old-source/LaporanJual/rincistockopname.php @@ -0,0 +1,70 @@ +"; + echo "table.tbl {width:950px;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:100px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $tgl = left($_GET['tgllini'],10); + $lini = right($_GET['tgllini'],2); + + + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Stock opname*/ + $query = "select m.tanggal,d.no_nota,d.kode_barang,b.nama_barang,d.nomor,d.jumlah_asli,d.jumlah_stok_sebelum, + (d.jumlah_asli*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hpscan, + (d.jumlah_stok_sebelum*(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0'))) hpstok + from barang b, no_barang n, d_stock_opname d, m_stock_opname m + where b.id_gabungan = n.id_gabungan + and (d.kode_barang = b.kode_barang and d.nomor=n.nomor) + and d.no_nota = m.no_nota + and m.konfirmasi = 1 + and d.jumlah_asli <> d.jumlah_stok_sebelum + and m.tanggal = '$tgl' + and m.strip = '$lini' + order by d.no_nota,d.kode_barang + "; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tanggal,$nota,$kdbrg,$nmbrg,$no,$jmlasli,$jmlstok,$hpscan,$hpstok); + + print("
"); + print("

Rinci Stock Opname



"); + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $HPselisih = $hpscan - $hpstok; + $ttHPselisih += $HPselisih; + print(" + "); + } + print(""); + print("
TanggalNotaKode Brg.Nama Brg.NomorJuml AsliJuml StokHP ScanHP StokSelisih
$tanggal$nota$kdbrg$nmbrg$no$jmlasli$jmlstok".number_format($hpscan,0,',','.')."".number_format($hpstok,0,',','.')."".number_format($HPselisih,0,',','.')."
Total HP".number_format($ttHPselisih,0,',','.')."

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + print("

"); + } + +?> diff --git a/old-source/LaporanJual/rincistokmin.php b/old-source/LaporanJual/rincistokmin.php new file mode 100644 index 0000000..36b8ffb --- /dev/null +++ b/old-source/LaporanJual/rincistokmin.php @@ -0,0 +1,66 @@ +"; + echo "table.tbl {width:950px;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:100px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $tgl = left($_GET['tgllini'],10); + $lini = right($_GET['tgllini'],2); + + + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Stock Minus*/ + $query = "SELECT b.kode_supplier,s.nama_supplier,b.kode_barang,b.nama_barang,n.nomor,SUM(n.stok) stok, + SUM(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok) + totalHP + from barang b,no_barang n,supplier s + WHERE n.stok<0 + and b.kode_supplier = s.kd_supplier + and b.id_gabungan = n.id_gabungan + and b.kode_strip = '$lini' + GROUP BY concat(n.id_gabungan,n.nomor)"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdsupp,$supp,$kdbrg,$nmbrg,$no,$jml,$hp); + + print("
"); + print("

Persediaan yang Minus



"); + print("

"); + print(""); + print(""); + + $ttHP = 0; + while(mysqli_stmt_fetch($stmt)){ + $ttHP += $hp; + print(" + "); + } + print(""); + print("
Kode SupplierSupplierKode Brg.Nama Brg.NomorJumlHP
$kdsupp$supp$kdbrg$nmbrg$no$jml".number_format($hp,0,',','.')."
Total HP".number_format($ttHP,0,',','.')."

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + print("

"); + } + +?> diff --git a/old-source/LaporanJual/rincitrans.php b/old-source/LaporanJual/rincitrans.php new file mode 100644 index 0000000..843d984 --- /dev/null +++ b/old-source/LaporanJual/rincitrans.php @@ -0,0 +1,161 @@ +"; + echo "table.tbl {width:950px;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate2']); + $endDate = decTgl($_POST['endDate2']); + + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Rekap Tunai*/ + $query = "SELECT m.tgl_nota,d.no_nota,d.kd_barang,b.nama_barang,s.nama_supplier,d.no_barang,d.jumlah,d.diskon,d.harga_jual, + d.harga_pokok,d.kode_pram + FROM d_nota_tunai d,barang b,m_nota_tunai m, supplier s + WHERE d.kd_barang = b.kode_barang + and b.kode_supplier = s.kd_supplier + and d.no_nota = m.no_nota + and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' + order by m.tgl_nota"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tgl,$nota,$kdbrg,$nmbrg,$kdlama,$no,$jml,$disc,$hj,$hp,$kdpram); + + print("
"); + print("

Rekap Transaksi Tunai



"); + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + print(""); + } + + print("
Tanggal NotaNo.NotaKode Brg.Nama Brg.SupplierNomorJumlDiscHJHPKd Pram
$tgl$nota$kdbrg$nmbrg$kdlama$no$jml$disc".number_format($hj,0,',','.')."$hp$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + /*----------------------------------------Rekap bon barang*/ + $query2 = "SELECT m.tgl_bon,d.no_bon,m.kode_plg,d.kd_brg,b.nama_barang,s.nama_supplier,d.nomor,d.jumlah,d.diskon,d.hrg_satuan,d.harga_pokok,d.kd_pram + FROM d_bon d, barang b, m_bon m, supplier s + WHERE d.kd_brg = b.kode_barang + and b.kode_supplier = s.kd_supplier + and d.no_bon = m.no_bon + and date(m.tgl_bon) BETWEEN '$startDate' AND '$endDate' + order by m.tgl_bon"; + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek = mysqli_stmt_num_rows($stmt2); + if($cek > 0){ + mysqli_stmt_bind_result($stmt2,$tgl,$nota,$kdplg,$kdbrg,$nmbrg,$kdlama,$no,$jml,$disc,$hj,$hp,$kdpram); + + print("
"); + print("

Rekap Transaksi Bon



"); + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt2)){ + print(""); + } + + print("
Tanggal NotaNo.NotaKd.PlgKode Brg.Nama Brg.SupplierNomorJumlDiscHJHPKd Pram
$tgl$nota$kdplg$kdbrg$nmbrg$kdlama$no$jml$disc".number_format($hj,0,',','.')."$hp$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + /*----------------------------------------Rekap Bawa */ + $query3 = "SELECT m.tgl_nota,d.no_nota,m.kd_customer,d.kd_barang,b.nama_barang,d.status_barang,s.nama_supplier,d.no_barang,d.jumlah,d.harga_satuan,n.harga_pokok,d.kode_pram + FROM d_nota_bawa d,barang b, no_barang n, m_nota_bawa m, supplier s + WHERE (d.kd_barang = b.kode_barang and d.no_barang = n.nomor) + and b.id_gabungan = n.id_gabungan + and d.no_nota = m.no_nota + and b.kode_supplier = s.kd_supplier + and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' + order by m.tgl_nota"; + //and status_barang is null + if($stmt3 = mysqli_prepare($conn,$query3)){ + mysqli_stmt_execute($stmt3); + mysqli_stmt_store_result($stmt3); + $cek = mysqli_stmt_num_rows($stmt3); + if($cek > 0){ + mysqli_stmt_bind_result($stmt3,$tgl,$nota,$kd_customer,$kdbrg,$nmbrg,$status,$kdlama,$no,$jml,$hj,$hp,$kdpram); + + print("
"); + print("

Rekap Transaksi Bawa



"); + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt3)){ + print(""); + } + + print("
Tanggal NotaNo.NotaKd. PlgKode Brg.Nama Brg.StatusSupplierNomorJumlHJHPKd Pram
$tgl$nota$kd_customer$kdbrg$nmbrg$status$kdlama$no$jml".number_format($hj,0,',','.')."$hp$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + /*----------------------------------------Rekap retur */ + $query4 = "SELECT m.tgl_nota,d.no_nota,d.kd_barang,b.nama_barang,s.nama_supplier,d.no_barang,d.jumlah,d.diskon,d.harga_jual,d.harga_pokok,d.kode_pram + FROM d_nota_retur d,barang b,m_nota_retur m, supplier s + WHERE d.kd_barang = b.kode_barang + and d.no_nota = m.no_nota + and b.kode_supplier = s.kd_supplier + and (m.status_nota = 'T' or m.status_nota = 'K' or m.status_nota = 'D') + and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' + order by m.tgl_nota"; + if($stmt4 = mysqli_prepare($conn,$query4)){ + mysqli_stmt_execute($stmt4); + mysqli_stmt_store_result($stmt4); + $cek = mysqli_stmt_num_rows($stmt4); + if($cek > 0){ + mysqli_stmt_bind_result($stmt4,$tgl,$nota,$kdbrg,$nmbrg,$kdlama,$no,$jml,$disc,$hj,$hp,$kdpram); + + print("
"); + print("

Rekap Transaksi Retur



"); + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt4)){ + print(""); + } + + print("
Tanggal NotaNo.NotaKode Brg.Nama Brg.Kode LamaNomorJumlDiscHJHPKd Pram
$tgl$nota$kdbrg$nmbrg$kdlama$no$jml$disc".number_format($hj,0,',','.')."$hp$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + print("
"); + } +?> diff --git a/old-source/LaporanJual/rincitransfer.php b/old-source/LaporanJual/rincitransfer.php new file mode 100644 index 0000000..3c99e0a --- /dev/null +++ b/old-source/LaporanJual/rincitransfer.php @@ -0,0 +1,67 @@ +"; + echo "table.tbl {width:950px;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:100px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $tgl = left($_GET['tgllini'],10); + $lini = right($_GET['tgllini'],2); + + + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Transfer Barang rinci*/ + $query = "SELECT m.`tgl_transfer`,m.faktur_oper,m.`toko_tujuan`,d.kode_barang_nota,b.nama_barang,d.nomor,sum(d.jumlah) juml,sum(d.jumlah*d.harga_satuan) hp,d.no_nota + FROM m_transfer m, d_transfer d, barang b + where m.id_transfer = d.id_transfer + and d.kode_barang_nota = b.kode_barang + and m.validasi = '1' + and date(m.tgl_transfer) = '$tgl' + and b.kode_strip = '$lini' + GROUP BY m.faktur_oper,concat(d.kode_barang_nota,d.nomor)"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tglnota,$nota,$supp,$kdbrg,$nmbrg,$no,$jml,$hp,$ktr); + + print("
"); + print("

Rekap Transfer Barang



"); + print("

"); + print(""); + print(" + "); + + $ttHP = 0; + while(mysqli_stmt_fetch($stmt)){ + $ttHP += $hp; + print(" + + "); + } + print(""); + print("
Tgl NotaNo.FakturToko TujuanKode Brg.Nama Brg.NomorJumlHPNota Asli
$tglnota$nota$supp$kdbrg$nmbrg$no$jml".number_format($hp,0,',','.')."$ktr
Total HP".number_format($ttHP,0,',','.')."

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + print("
"); + } + +?> diff --git a/old-source/LaporanJual/rincitransferkembali.php b/old-source/LaporanJual/rincitransferkembali.php new file mode 100644 index 0000000..08b37d1 --- /dev/null +++ b/old-source/LaporanJual/rincitransferkembali.php @@ -0,0 +1,67 @@ +"; + echo "table.tbl {width:950px;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:100px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $tgl = left($_GET['tgllini'],10); + $lini = right($_GET['tgllini'],2); + + + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Transfer Barang rinci*/ + $query = "SELECT m.`tgl_transfer`,m.faktur_oper,m.`toko_tujuan`,d.kode_barang_nota,b.nama_barang,d.nomor,sum(d.jumlah) juml,sum(d.jumlah*d.harga_satuan) hp,d.no_nota + FROM m_transfer_kembali m, d_transfer_kembali d, barang b + where m.id_transfer = d.id_transfer + and d.kode_barang_nota = b.kode_barang + and m.validasi = '1' + and date(m.tgl_kembali) = '$tgl' + and b.kode_strip = '$lini' + GROUP BY m.faktur_oper,concat(d.kode_barang_nota,d.nomor)"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tglnota,$nota,$supp,$kdbrg,$nmbrg,$no,$jml,$hp,$ktr); + + print("
"); + print("

Rekap Transfer Barang Kembali



"); + print("

"); + print(""); + print(" + "); + + $ttHP = 0; + while(mysqli_stmt_fetch($stmt)){ + $ttHP += $hp; + print(" + + "); + } + print(""); + print("
Tgl NotaNo.FakturToko TujuanKode Brg.Nama Brg.NomorJumlHPNota Asli
$tglnota$nota$supp$kdbrg$nmbrg$no$jml".number_format($hp,0,',','.')."$ktr
Total HP".number_format($ttHP,0,',','.')."

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + print("
"); + } + +?> diff --git a/old-source/LaporanJual/send_lapdetailjual.php b/old-source/LaporanJual/send_lapdetailjual.php new file mode 100644 index 0000000..650135d --- /dev/null +++ b/old-source/LaporanJual/send_lapdetailjual.php @@ -0,0 +1,89 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $idToko = $_POST['idToko']; + $bulan = $_POST['bulan']; + $tahun = $_POST['tahun']; + + if(bukaKoneksi() AND bukaKoneksiPA()){ + global $conn; + global $connPA; + + $query = "SELECT * FROM tmp_lapdetailjual"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tunai,$omset,$andil); + + echo "

[Home]

"; + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + + print(" + "); + + $query_server = "SELECT tahun,bulan,toko FROM andil_tunai + WHERE tahun = '$tahun' + AND bulan = '$bulan' + AND toko = '$idToko'"; + if($stmt2 = mysqli_prepare($connPA,$query_server)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + //cek di pusat,jika ada data yg sama,maka di update + while(mysqli_stmt_fetch($stmt2)){ + $queryUpdate = "UPDATE andil_tunai SET total_tunai = $tunai, total_omset = $omset, andil = $andil + WHERE tahun = '$tahun' + AND bulan = '$bulan' + AND toko = '$idToko'"; + runQueryPA($queryUpdate); + } + }else{ + // jika tdk ada data yg sama,masukkan data yang baru. + $queryins = "INSERT INTO andil_tunai(tahun,bulan,toko,total_tunai,total_omset,andil) + VALUES ('$tahun', '$bulan', '$idToko', $tunai, $omset, $andil)"; + runQueryPA($queryins); + } + } + } + print("
Total TunaiTotal OmsetAndil Tunai
".number_format($tunai,0,',','.')."".number_format($omset,0,',','.')."".number_format($andil,2,'.',',')."

"); + + echo ""; + echo ""; + echo ""; + echo ""; + echo "
"; + echo "Data berhasil dikirim."; + echo "
"; + }else{ + echo "Data tidak ada!"; + } + $queryclear1= "DROP TABLE IF EXISTS tmp_lapdetailjual"; + runQuery($queryclear1); + + } + } +?> diff --git a/old-source/LaporanJual/send_lapjualperkat.php b/old-source/LaporanJual/send_lapjualperkat.php new file mode 100644 index 0000000..9ec274a --- /dev/null +++ b/old-source/LaporanJual/send_lapjualperkat.php @@ -0,0 +1,95 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $idToko = $_POST['idToko']; + $bulan = $_POST['bulan']; + $tahun = $_POST['tahun']; + + if(bukaKoneksi() AND bukaKoneksiPA()){ + global $conn; + global $connPA; + + $query = "SELECT tl.kel_jns,tl.lini,tl.vol,tl.totHJ,tl.nettprofit + FROM tmp_lapjualperkat tl + ORDER BY tl.kel_jns,tl.lini"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kat,$lini,$jml,$om,$profit); + + $jum = 0; + echo "

[Home]

"; + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + + print(" + "); + + $query_server = "SELECT tahun,bulan,toko,kategori,lini FROM om_kat_lini + WHERE tahun = '$tahun' + AND bulan = '$bulan' + AND toko = '$idToko' + AND lini = '$lini'"; + if($stmt2 = mysqli_prepare($connPA,$query_server)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + //cek di pusat,jika ada data yg sama,maka di update + while(mysqli_stmt_fetch($stmt2)){ + $queryUpdate = "UPDATE om_kat_lini SET unit = $jml, omset = $om, nett_profit = $profit + WHERE tahun = '$tahun' + AND bulan = '$bulan' + AND toko = '$idToko' + AND lini = '$lini'"; + runQueryPA($queryUpdate); + } + }else{ + // jika tdk ada data yg sama,masukkan data yang baru. + $queryins = "INSERT INTO om_kat_lini(tahun,bulan,toko,kategori,lini,unit,omset,nett_profit) + VALUES ('$tahun', '$bulan', '$idToko', '$kat', '$lini', $jml, $om, $profit)"; + runQueryPA($queryins); + } + } + $jum += 1; + } + print("
KategoriLiniVolOmsetNett Profit
$kat$lini$jml".number_format($om,0,',','.')."".number_format($profit,2,'.',',')."

"); + + echo ""; + echo ""; + echo ""; + echo ""; + echo "
"; + echo "Ada ". $jum ." data yang berhasil dikirim."; + echo "
"; + }else{ + echo "Data tidak ada!"; + } + } + $queryclear1= "DROP TABLE IF EXISTS tmp_lapjualperkat"; + runQuery($queryclear1); + + } +?> diff --git a/old-source/LaporanJual/stokps1c.php b/old-source/LaporanJual/stokps1c.php new file mode 100644 index 0000000..5343eb8 --- /dev/null +++ b/old-source/LaporanJual/stokps1c.php @@ -0,0 +1,100 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Persediaan Per Supplier +
+
+
+ + +
Kode Supplier: + +
Lini Produk : + +
+
+
+
+
+
+ +
+
Cari Supplier
+
+ +
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + + +
+ + diff --git a/old-source/LaporanJual/transbrg.php b/old-source/LaporanJual/transbrg.php new file mode 100644 index 0000000..b64911b --- /dev/null +++ b/old-source/LaporanJual/transbrg.php @@ -0,0 +1,81 @@ + + + + + :: Pengadaan Barang + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Transfer Antar Toko & Transfer Barang Kembali +
+
+
+ + + +
Range Tanggal: s/d
+
+
+
+
+ +
+ + diff --git a/old-source/LaporanJual/transbrg.php~ b/old-source/LaporanJual/transbrg.php~ new file mode 100644 index 0000000..4c0adfa --- /dev/null +++ b/old-source/LaporanJual/transbrg.php~ @@ -0,0 +1,72 @@ + + + + + Amigo Group :: Pengadaan Barang + + + + + + + + + + + +
+
+ +
+
+
Laporan Transfer Antar Toko
+
+
+
+ + + +
Range Tanggal: s/d
+
+
+
+
+ +
+ + diff --git a/old-source/LaporanJual/tunai.php b/old-source/LaporanJual/tunai.php new file mode 100644 index 0000000..ad9f35f --- /dev/null +++ b/old-source/LaporanJual/tunai.php @@ -0,0 +1,117 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Rekap Transaksi Tunai +
+
+
+ + + +
Range Tanggal: s/d
+
+
+
+
+ + + +
Range Tanggal: s/d
+
+
+
+
+
Laporan Retur Penjualan Barang Konsinyasi + + + +
Range Tanggal: s/d
+
+
+
+
+ +
+ + diff --git a/old-source/README.md b/old-source/README.md new file mode 100644 index 0000000..e69de29 diff --git a/old-source/ajaxbarang.php b/old-source/ajaxbarang.php new file mode 100644 index 0000000..8efbeef --- /dev/null +++ b/old-source/ajaxbarang.php @@ -0,0 +1,410 @@ + +prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function hapus_beli($id_barang){ + if ($id_barang != "") { + $array_data = array(); + require_once 'db_login.inc.php'; + $pemakai = $_SESSION["useracc"]; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $query = "DELETE FROM `tPembelian$pemakai` WHERE id = '".$id_barang."' LIMIT 1"; + $stmt = $mysqli->prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function edit_beli($id_barang){ + if ($id_barang != "") { + $array_data = array(); + require_once 'db_login.inc.php'; + $pemakai = $_SESSION["useracc"]; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT *,DATE_FORMAT(exp,'%m-%d-%Y') expdate, + (REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + FROM `tPembelian$pemakai` WHERE id = '".$id_barang."' LIMIT 1"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'id' => $a['id'], + 'kode_barang' => $a['kode_barang'], + 'barcode' => $a['barcode'], + 'jumlah' => $a['jumlah'], + 'subtotal' => $a['subtotal'], + 'disc' => $a['disc'], + 'discrp' => $a['discrp'], + 'profit' => $a['profit'], + 'ppn' => $a['ppn'], + 'harga_pokok' => $a['hp'], + 'harga_jual' => $a['harga_jual'], + 'exp' => $a['expdate'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + + +function simpan($kdbrg,$barcode,$namabrg,$kdsupp,$group,$ceklini,$hp,$hj,$isi2,$hj2,$isi3,$hj3,$satuan,$tglentry,$stock,$operasi) +{ + require_once 'db_login.inc.php'; + require_once "func_lib.php"; + $harray = array(); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $tahun = substr($tglentry,0,4); + $bulan = substr($tglentry,5,2); + $idgabungan = "A8".$kdbrg; + $hrgp = convHrgP($hp); + if ($operasi === "simpan") + { + if($kdbrg != "" && $barcode != ""){ + $stmt = $mysqli->prepare("INSERT INTO barang( + `kode_barang`, + `kode_lama`, + `nama_barang`, + `kode_toko`, + `tahun`, + `bulan`, + `id_gabungan`, + `kode_strip`, + `kode_supplier`, + `ked_produk`) + VALUES ('$kdbrg','$barcode','$namabrg','A8','$tahun','$bulan','$idgabungan','$group','$kdsupp','$ceklini')"); + $stmt->execute(); + $stmt2 = $mysqli->prepare("INSERT INTO no_barang( + `id_gabungan`, + `nomor`, + `harga_pokok`, + `harga_jual`, + `harga_jual2`, + `isi_max2`, + `harga_jual3`, + `isi_max3`, + `satuan`, + `stok_min`, + `stok`) + VALUES ('$idgabungan','1','$hrgp','$hj','$hj2','$isi2','$hj3','$isi3','$satuan','1','$stock')"); + $stmt2->execute(); + if($stmt->affected_rows > 0) { + $harray[0] = 1; + $stmt->close(); + } else { + $harray[0] = 0; + } + }else{ + $harray[0] = 2; + } + } elseif ($operasi === "update") { + + $stmt = $mysqli->prepare("UPDATE barang SET + `kode_lama`='$barcode', + `nama_barang`='$namabrg', + `kode_strip` = '$group', + `ked_produk` = '$ceklini' + WHERE kode_barang = '$kdbrg'"); + $stmt->execute(); + $stmt2 = $mysqli->prepare("UPDATE no_barang SET + `harga_pokok`='$hrgp', + `harga_jual`='$hj', + `harga_jual2`='$hj2', + `isi_max2`='$isi2', + `harga_jual3`='$hj3', + `isi_max3`='$isi3', + `satuan`='$satuan' + WHERE id_gabungan = '$idgabungan'"); + $stmt2->execute(); + if($stmt->affected_rows > 0) { + $harray[0] = 1; + $stmt->close(); + } else + { + $harray[0] = 0; + } + } + $mysqli->close(); + echo json_encode($harray); +} + +function cek_barang($kd_barang) +{ + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT COUNT(*) FROM barang WHERE kode_barang = '$kd_barang'")->fetch_array(); + if ($data[0] > 0) + { + return true; + } else + { + return false; + } +} + +function cari_barang($nama) { + if($nama != "") { + $harray = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT kode_barang, kode_lama, nama_barang, nama_supplier FROM barang b, supplier s + WHERE b.kode_supplier = s.kd_supplier + AND (kode_lama LIKE '%".$nama."%' OR nama_barang LIKE '%".$nama."%')"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'], + 'barcode' => $a['kode_lama'], + 'nama_barang' => $a['nama_barang'], + 'nama_supplier' => $a['nama_supplier'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function cari_barang_purchase($nama) { + if($nama != "") { + $harray = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT kode_barang, kode_lama, nama_barang, nama_supplier FROM barang b, supplier s + WHERE b.kode_supplier = s.kd_supplier + AND (kode_lama LIKE '%".$nama."%' OR nama_barang LIKE '%".$nama."%')"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'], + 'barcode' => $a['kode_lama'], + 'nama_barang' => $a['nama_barang'], + 'nama_supplier' => $a['nama_supplier'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function ambil_barang($id_barang) { + if ($id_barang != "") { + $array_data = array(); + require_once 'db_login.inc.php'; + require_once 'func_lib.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT b.kode_barang,b.kode_lama,b.nama_barang,b.kode_strip,s.nama_strip, + b.kode_supplier,b.ked_produk,k.ked_produk namakedproduk, + n.harga_pokok,n.harga_jual,n.harga_jual2,n.isi_max2,n.harga_jual3,n.isi_max3, + n.satuan,sb.namaSatuanBarang,n.stok + FROM barang b,no_barang n,kedalaman_produk k,strip s,satuan_barang sb + WHERE b.id_gabungan = n.id_gabungan + AND b.kode_strip = s.kd_strip + AND b.kode_strip = k.kode_strip + AND b.ked_produk = k.kode_ked_produk + AND n.satuan = sb.idSatuanBarang + AND b.kode_barang = '".$id_barang."'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $hplama = DeconvHrgP($a['harga_pokok']); + $array_data[$idx] = array( + 'kode_barang' => $a['kode_barang'], + 'barcode' => $a['kode_lama'], + 'nama_barang' => $a['nama_barang'], + 'kode_strip' => $a['kode_strip'], + 'nama_strip' => $a['nama_strip'], + 'kode_supplier' => $a['kode_supplier'], + 'ked_produk' => $a['ked_produk'], + 'namakedproduk' => $a['namakedproduk'], + 'harga_pokok' => $hplama, + 'harga_jual' => $a['harga_jual'], + 'harga_jual2' => $a['harga_jual2'], + 'isi_max2' => $a['isi_max2'], + 'harga_jual3' => $a['harga_jual3'], + 'isi_max3' => $a['isi_max3'], + 'satuan' => $a['satuan'], + 'namaSatuanBarang' => $a['namaSatuanBarang'], + 'stokbrg' => $a['stok'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($array_data); + } +} + +function ambil_kode() { + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT kode_barang FROM barang ORDER BY kode_barang DESC limit 1"); + if($data->num_rows > 0) { + $a = $data->fetch_array(MYSQLI_NUM); + //$kode_awal = $a[0]; + //$kode = (int)$a[0] + 1; + //$kode = '0'.$kode; + //$array_data[0] = $kode; + + $kode_awal = intval(substr($a[0],1,6)); + $kode_awal++; + $strUrut = strlen($kode_awal); + for($i=1;$i<=(6-$strUrut);$i++){ + $kode = "0" . $kode_awal; + } + $array_data[0] = $kode; + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); +} + +function cekBarang($barcode){ + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT kode_barang, kode_lama FROM barang WHERE kode_barang = '$barcode' OR kode_lama = '$barcode' limit 1"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $array_data[$idx] = array( + 'kode_barang' => $a['kode_barang'], + 'barcode' => $a['kode_lama'] + ); + $idx++; + } + $data->close(); + }else{ + $array_data[0] = 0; + } + $mysqli->close(); + echo json_encode($array_data); +} + +function cekFaktur($faktur){ + $harray = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT no_faktur FROM m_pembelian WHERE no_faktur = '$faktur' limit 1"); + if($data->num_rows > 0) { + $harray[0] = 1; + $data->close(); + } else { + $harray[0] = 0; + } + $mysqli->close(); + echo json_encode($harray); +} + +?> diff --git a/old-source/ajaxbayar.php b/old-source/ajaxbayar.php new file mode 100644 index 0000000..e5a4651 --- /dev/null +++ b/old-source/ajaxbayar.php @@ -0,0 +1,109 @@ + +prepare("INSERT INTO bayar( + `periode_awal`, + `periode_akhir`, + `tgl_bayar`, + `jenis_bayar`, + `tgl_cair`, + `no_giro`, + `kd_supplier`, + `diskon`, + `penyesuaian`, + `materai`, + `total_bayar`, + `ket_bayar` + ) + VALUES ('$per_awal','$per_akhir','$tglbyr','$jnsbayar','$tglcair','$nogiro', + '$kdsupplier','$disc','$penyesuaian','$materai','$grandtotal','$ketbayar')"); + $dtInsert->execute(); + + $qry_select = $mysqli->query("SELECT MAX(`IDbayar`) id FROM `bayar` WHERE 1"); + if($qry_select->num_rows > 0){ + while($n = $qry_select->fetch_array(MYSQLI_ASSOC)){ + $id = $n['id']; + } + } + validBeli($id); + validRetur($id); + if($dtInsert->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $dtInsert->close(); + + $mysqli->close(); + } + + echo json_encode($array_data); +} + +function validBeli($id){ + $notabelis = $_POST['notabeli']; + + $mysqli_beli = new mysqli(HOST, USER, PASSWORD, DATABASE); + + foreach ($notabelis as $fakt => $valnotabelis){ + $update_beli = $mysqli_beli->prepare("UPDATE `m_pembelian` SET status_bayar = '1', + IDbayar = '$id' + WHERE no_faktur = '$fakt'"); + $update_beli->execute(); + + } + + $mysqli_beli->close(); +} + +function validRetur($id){ + $notareturs = $_POST['notaretur']; + + $mysqli_retur = new mysqli(HOST, USER, PASSWORD, DATABASE); + + foreach ($notareturs as $nota => $valnotareturs){ + $update_retur = $mysqli_retur->prepare("UPDATE `m_retur_beli` SET status_bayar = '1', + IDbayar = '$id' + WHERE no_nota = '$nota'"); + $update_retur->execute(); + + } + $mysqli_retur->close(); +} + +?> diff --git a/old-source/ajaxdlmpdk.php b/old-source/ajaxdlmpdk.php new file mode 100644 index 0000000..e59eb6d --- /dev/null +++ b/old-source/ajaxdlmpdk.php @@ -0,0 +1,181 @@ + +prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function cari_dlmpdk($nama) { + if($nama != "") { + $harray = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $nama = addslashes($nama); + $data = $mysqli->query("SELECT * FROM kedalaman_produk WHERE kode_strip LIKE '%".$nama."%' ORDER BY kode_strip,kode_ked_produk"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kode_strip' => stripcslashes($a['kode_strip']), + 'kode_ked_produk' => $a['kode_ked_produk'], + 'ked_produk' => $a['ked_produk'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function ambil_dlmpdk($id_dlmpdk) { + if ($id_dlmpdk != "") { + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM kedalaman_produk WHERE concat(kode_strip,kode_ked_produk) = '".$id_dlmpdk."' ORDER BY kode_ked_produk"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $array_data[$idx] = array( + 'kode_ked_produk' => $a['kode_ked_produk'], + 'kode_strip' => stripcslashes($a['kode_strip']), + 'ked_produk' => $a['ked_produk'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($array_data); + } +} + + + +function transaksi_dlmpdk($lini,$id_dlmpdk) { + if($id_dlmpdk != ""){ + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM kedalaman_produk WHERE concat(kode_strip,kode_ked_produk) = '".$lini.$id_dlmpdk."'"); + if($data->num_rows > 0) { + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + /* update data dlmpdk */ + update_dlmpdk(); + } else { + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + /* simpan data dlmpdk baru */ + simpan_dlmpdk(); + } + } +} + +function update_dlmpdk(){ + if(isset($_POST)) { + $kode_dlmpdk = $_POST['kodedlmpdk']; + $lini = $_POST['lini']; + $nama = $_POST['nama']; + + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $query = "UPDATE kedalaman_produk SET "; + $query .= "kode_ked_produk = ?, "; + $query .= "kode_strip = ?, "; + $query .= "ked_produk = ? "; + $query .= "WHERE kode_ked_produk = ? AND kode_strip = ?"; + + $stmt = $mysqli->prepare($query); + $stmt->bind_param("sssss", $kode_dlmpdk, $lini, $nama, $kode_dlmpdk, $lini); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function simpan_dlmpdk() { + if(isset($_POST)) { + $kode_dlmpdk = $_POST['kodedlmpdk']; + $lini = $_POST['lini']; + $nama = $_POST['nama']; + + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $query = "INSERT INTO kedalaman_produk(kode_ked_produk, kode_strip, ked_produk) VALUES (?, ?, ?)"; + $stmt = $mysqli->prepare($query); + $stmt->bind_param("sss", $kode_dlmpdk, $lini, $nama); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} +?> \ No newline at end of file diff --git a/old-source/ajaxedittmpbeli.php b/old-source/ajaxedittmpbeli.php new file mode 100644 index 0000000..f2c5e59 --- /dev/null +++ b/old-source/ajaxedittmpbeli.php @@ -0,0 +1,62 @@ + +prepare("UPDATE `tPembelian$pemakai` SET + `kode_barang` = '$kodebarang', + `barcode` = '$barcode', + `nm_brg` = '$nama', + `jumlah` = '$jmlbeli', + `subtotal` = '$subtotal', + `disc` = '$disc', + `discrp` = '$discrp', + `profit` = '$profit', + `ppn` = '$ppn', + `harga_pokok` = '$hpbaru', + `harga_jual` = '$hjbaru', + `exp` = '$expdate' + WHERE id = '$id'"); + $dtUpdate->execute(); + if($dtUpdate->affected_rows > 0) { + $harray[0] = 1; + $dtUpdate->close(); + } else { + $harray[0] = 0; + } + $mysqli->close(); + }else{ + $harray[0] = 2; + } + echo json_encode($harray); + +?> + \ No newline at end of file diff --git a/old-source/ajaxkaryawan.php b/old-source/ajaxkaryawan.php new file mode 100644 index 0000000..1ff7cfb --- /dev/null +++ b/old-source/ajaxkaryawan.php @@ -0,0 +1,248 @@ + +query("SELECT nik,nama,id_pekerjaan FROM karyawan WHERE nama LIKE '%".$nama."%' ORDER BY nik"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'nik' => $a['nik'], + 'nama' => stripcslashes($a['nama']), + 'id_pekerjaan' => $a['id_pekerjaan'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + }else{ + $harray = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $nama = addslashes($nama); + $data = $mysqli->query("SELECT nik,nama,id_pekerjaan FROM karyawan ORDER BY nik"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'nik' => $a['nik'], + 'nama' => stripcslashes($a['nama']), + 'id_pekerjaan' => $a['id_pekerjaan'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function ambil_kary($id_kary) { + if ($id_kary != "") { + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM karyawan WHERE nik = '".$id_kary."' ORDER BY nik"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $array_data[$idx] = array( + 'nik' => $a['nik'], + 'nama' => $a['nama'], + 'username' => $a['username'], + 'password' => $a['password'], + 'id_pekerjaan' => $a['id_pekerjaan'], + 'id_department' => $a['id_department'], + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($array_data); + } +} + +function hapus_kary($id_kary){ + if ($id_kary != "") { + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $query = "DELETE FROM karyawan WHERE nik = '".$id_kary."' LIMIT 1"; + $stmt = $mysqli->prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + + +function transaksi_kary($id_kary) { + if($id_kary != ""){ + // cek data + $nik = $_POST['nik']; + $username = $_POST['uname']; + $passwdlama = MD5($_POST['passwdlama']); + + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT nik,username,password FROM karyawan WHERE nik = '".$id_kary."' ORDER BY nik"); + $dt = $data->fetch_array(MYSQLI_ASSOC); + if ($dt['password']=='') + { $pass = MD5($dt['password']); } + else + { $pass = $dt['password']; } + if ($dt['username']=='') + { $uname = $username ; } + else + { $uname = $dt['username']; } + $nomor_induk = $dt['nik']; + + if($data->num_rows > 0) { + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + + /* update data kary */ + if ($nik==$nomor_induk && $passwdlama==$pass) + { + update_kary(); + } + else + { + alert_error(); + } + + } else { + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + /* simpan data kary baru */ + simpan_kary(); + + } + } +} + +function alert_error(){ + $array_data = array(); + $array_data[0] = 0; + echo json_encode($array_data); +} + +function update_kary(){ + if(isset($_POST)) { + $kode_kary = $_POST['nik']; + $nama_kary = $_POST['namakary']; + $uname = $_POST['uname']; + $passwdlama = $_POST['passwdlama']; + $passwd = MD5($_POST['passwd']); + $job = $_POST['job']; + $department = $_POST['department']; + + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $query = "UPDATE karyawan SET "; + $query .= "nama = ?, "; + $query .= "username = ?, "; + $query .= "password = ?, "; + $query .= "id_pekerjaan = ?, "; + $query .= "id_department = ? "; + $query .= "WHERE nik = ?"; + + $stmt = $mysqli->prepare($query); + $stmt->bind_param("ssssss", $nama_kary, $uname, $passwd, $job, $department, $kode_kary); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function simpan_kary() { + if(isset($_POST)) { + $kode_kary = $_POST['nik']; + $nama_kary = $_POST['namakary']; + $uname = $_POST['uname']; + $passwd = MD5($_POST['passwd']); + $job = $_POST['job']; + $department = $_POST['department']; + $last_login = '0000-00-00 00:00:00'; + + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $query = "INSERT INTO karyawan VALUES (?, ?, ?, ?, ?, ?, ?)"; + $stmt = $mysqli->prepare($query); + $stmt->bind_param("sssssss", $kode_kary, $nama_kary, $uname, $passwd, $job, $department, $last_login); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} +?> \ No newline at end of file diff --git a/old-source/ajaxpelanggan.php b/old-source/ajaxpelanggan.php new file mode 100644 index 0000000..9db2460 --- /dev/null +++ b/old-source/ajaxpelanggan.php @@ -0,0 +1,266 @@ + +prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function simpan($id_pel, $alias, $stsmember, $ktp, $nama, $alamat, $wilayah, $tp_lahir, $tg_lahir, $jen_kel, $agama, $kerja, $statusnikah, $telp, $hp, $email, $upline, $batasbon, + $nilaibon, $bonistimewa, $komisi, $komisiambil, $statuspel, $tglentry, $operasi) +{ + require_once 'db_login.inc.php'; + $harray = array(); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if ($operasi === "simpan") + { + if($nama != "" && $alamat != ""){ + $stmt = $mysqli->prepare("INSERT INTO pelanggan(kd_customer, ktp, nama, alamat, wilayah, tempat_lahir, tgl_lahir, jns_kelamin, agama, pekerjaan, + status_nikah, telp, ponsel, email, upline, bts_bon, nilai_bon, bts_bon_istimewa, nilai_komisi, komisi_diambil, tgl_entry, jenis_customer) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); + $stmt->bind_param("sssssssssssssssiiiiiss", $id_pel, $ktp, $nama, $alamat, $wilayah, $tp_lahir, $tg_lahir, $jen_kel, $agama, $kerja, $statusnikah, $telp, + $hp, $email, $upline, $batasbon, $nilaibon, $bonistimewa, $komisi, $komisiambil, $tglentry, $statuspel); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $harray[0] = 1; + $stmt->close(); + } else { + $harray[0] = 0; + } + }else{ + $harray[0] = 2; + } + } elseif ($operasi === "update") { + $stmt = $mysqli->prepare("UPDATE pelanggan SET ktp=?, nama=?, alamat=?, wilayah=?, tempat_lahir=?, tgl_lahir=?, jns_kelamin=?, agama=?, pekerjaan=?, + status_nikah=?, telp=?, ponsel=?, email=?, upline=?, bts_bon=?, nilai_bon=?, bts_bon_istimewa=?, nilai_komisi=?, komisi_diambil=?, + jenis_customer=? WHERE kd_customer=?"); + $stmt->bind_param("ssssssssssssssiiiiiss", $ktp, $nama, $alamat, $wilayah, $tp_lahir, $tg_lahir, $jen_kel, $agama, $kerja, $statusnikah, $telp, $hp, + $email, $upline, $batasbon, $nilaibon, $bonistimewa, $komisi, $komisiambil, $statuspel, $id_pel); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $harray[0] = 1; + $stmt->close(); + } else + { + $harray[0] = 0; + } + } + $mysqli->close(); + echo json_encode($harray); +} + +function cek_pelanggan($id_pelanggan) +{ + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT COUNT(*) FROM pelanggan WHERE kd_customer = '{$id_pelanggan}'")->fetch_array(); + if ($data[0] > 0) + { + return true; + } else + { + return false; + } +} + +function cari_pelanggan($nama) { + if($nama != "") { + $harray = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT kd_customer, nama, alamat, nilai_bon, bts_bon FROM pelanggan WHERE nama LIKE '%".$nama."%'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_customer' => $a['kd_customer'], + 'nama' => $a['nama'], + 'alamat' => $a['alamat'], + 'nilai_bon' => number_format($a['nilai_bon'],0,',','.'), + 'bts_bon' => number_format($a['bts_bon'],0,',','.') + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function cari_upline($nama) { + if($nama != "") { + $harray = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT kd_customer, nama, alamat, nilai_bon, bts_bon FROM pelanggan WHERE nama LIKE '%".$nama."%' AND upline = '#'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_customer' => $a['kd_customer'], + 'nama' => $a['nama'], + 'alamat' => $a['alamat'], + 'nilai_bon' => number_format($a['nilai_bon'],0,',','.'), + 'bts_bon' => number_format($a['bts_bon'],0,',','.') + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function ambil_pelanggan($id_pelanggan) { + if ($id_pelanggan != "") { + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM pelanggan WHERE kd_customer = '".$id_pelanggan."'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $tgl_lahir = ''; + + if($a['tgl_lahir'] != "") { + $tgl_lahir = substr($a['tgl_lahir'],8,2)."-".substr($a['tgl_lahir'],5,2)."-".substr($a['tgl_lahir'],0,4); + } else { + $tgl_lahir = $a['tgl_lahir']; + } + + $array_data[$idx] = array( + 'kd_customer' => $a['kd_customer'], + 'alias' => $a['alias'], + 'member' => $a['member'], + 'ktp' => $a['ktp'], + 'nama' => $a['nama'], + 'alamat' => $a['alamat'], + 'kd_lokasi' => $a['kd_lokasi'], + 'wilayah' => $a['wilayah'], + 'tempat_lahir' => $a['tempat_lahir'], + 'tgl_lahir' => $tgl_lahir, + 'jns_kelamin' => $a['jns_kelamin'], + 'agama' => $a['agama'], + 'kd_lokasi' => $a['kd_lokasi'], + 'pekerjaan' => $a['pekerjaan'], + 'status_nikah' => $a['status_nikah'], + 'telp' => $a['telp'], + 'ponsel' => $a['ponsel'], + 'email' => $a['email'], + 'status' => $a['status'], + 'upline' => $a['upline'], + 'bts_bon' => $a['bts_bon'], + 'nilai_bon' => $a['nilai_bon'], + 'bts_bon_istimewa' => $a['bts_bon_istimewa'], + 'nilai_komisi' => $a['nilai_komisi'], + 'komisi_diambil' => $a['komisi_diambil'], + 'jenis_customer' => $a['jenis_customer'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($array_data); + } +} + +function ambil_kode() { + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT kd_customer FROM pelanggan ORDER BY kd_customer DESC limit 1"); + if($data->num_rows > 0) { + $a = $data->fetch_array(MYSQLI_NUM); + //$kode_awal = substr($a[0],2,6); + $kode_awal = intval(substr($a[0],2,6)); + $kode_awal++; + $strUrut = strlen($kode_awal); + for($i=1;$i<=(6-$strUrut);$i++){ + $kode_awal = "0" . $kode_awal; + } + + //$kode = $kode_awal + 1; + $kode = 'A8'.$kode_awal; + $array_data[0] = $kode; + + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); +} +?> \ No newline at end of file diff --git a/old-source/ajaxplafon.php b/old-source/ajaxplafon.php new file mode 100644 index 0000000..184521e --- /dev/null +++ b/old-source/ajaxplafon.php @@ -0,0 +1,127 @@ + +query("SELECT kd_customer, nama, alamat, nilai_bon, bts_bon FROM pelanggan WHERE nama LIKE '%".$nama."%'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_customer' => $a['kd_customer'], + 'nama' => $a['nama'], + 'alamat' => $a['alamat'], + 'nilai_bon' => number_format($a['nilai_bon'],0,',','.'), + 'bts_bon' => number_format($a['bts_bon'],0,',','.') + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function ambil_pelanggan($id_pelanggan) { + if ($id_pelanggan != "") { + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM pelanggan WHERE kd_customer = '".$id_pelanggan."'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $tgl_lahir = ''; + + if($a['tgl_lahir'] != "") { + $tgl_lahir = substr($a['tgl_lahir'],8,2)."-".substr($a['tgl_lahir'],5,2)."-".substr($a['tgl_lahir'],0,4); + } else { + $tgl_lahir = $a['tgl_lahir']; + } + + $array_data[$idx] = array( + 'kd_customer' => $a['kd_customer'], + 'ktp' => $a['no_ktp_sim'], + 'nama' => $a['nama'], + 'alamat' => $a['alamat'], + 'tempat_lahir' => $a['tempat_lahir'], + 'tgl_lahir' => $tgl_lahir, + 'jns_kelamin' => $a['jns_kelamin'], + 'agama' => $a['agama'], + 'kd_lokasi' => $a['kd_lokasi'], + 'pekerjaan' => $a['pekerjaan'], + 'status_nikah' => $a['status_nikah'], + 'telp' => $a['telp'], + 'ponsel' => $a['ponsel'], + 'email' => $a['email'], + 'status' => $a['status'], + 'upline' => $a['upline'], + 'bts_bon' => number_format($a['bts_bon'],0,',','.'), + 'nilai_bon' => number_format($a['nilai_bon'],0,',','.'), + 'bts_bon_istimewa' => number_format($a['bts_bon_istimewa'],0,',','.'), + 'nilai_komisi' => number_format($a['nilai_komisi'],0,',','.'), + 'komisi_diambil' => number_format($a['komisi_diambil'],0,',','.'), + 'jenis_customer' => number_format($a['jenis_customer'],0,',','.') + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($array_data); + } +} + +function update_plafon($kode, $plafon) { + if ($kode != "" && $plafon != "") { + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $query = "UPDATE pelanggan SET bts_bon = ? WHERE kd_customer = ?"; + $stmt = $mysqli->prepare($query); + $stmt->bind_param("is", $plafon, $kode); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +?> \ No newline at end of file diff --git a/old-source/ajaxpurchase.php b/old-source/ajaxpurchase.php new file mode 100644 index 0000000..1a28978 --- /dev/null +++ b/old-source/ajaxpurchase.php @@ -0,0 +1,141 @@ + +prepare("INSERT INTO `m_pembelian`( + `no_faktur`, + `tgl_nota`, + `tgl_masuk`, + `tgl_jatuh_tempo`, + `kd_supplier`, + `status`, + `diskon`, + `diskon_pembelian`, + `ppn`, + `nik`, + `rp_beli`, + `total_beli`, + `validasi`, + `keterangan`, + `tgl_entry`, + `status_revisi` + ) + VALUES ('$nofaktur','$tglNota','$tgl_masuk','$tglJthTmp','$kdsupp','$status', + '$discProNota','$diskNota','$ppnNota','$nik','$trBeliNett','$tjBeli','$validasi', + '$ket','$tgl_entry','$status_revisi')"); + $dtInsert->execute(); + if($dtInsert->affected_rows > 0) { + simpan_d_pembelian(); + drop_temp(); + $harray[0] = 1; + $dtInsert->close(); + } else { + $harray[0] = 0; + } + $mysqli->close(); + }else{ + $harray[0] = 2; + } + echo json_encode($harray); +} + +function simpan_d_pembelian(){ + $nofaktur = $_REQUEST['nofaktur']; + $pemakai = $_SESSION["useracc"]; + + $mysqli_dbeli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $qry_select = $mysqli_dbeli->query("SELECT * FROM `tPembelian$pemakai` ORDER BY id"); + if($qry_select->num_rows > 0){ + while($pembelian = $qry_select->fetch_array(MYSQLI_ASSOC)){ + $kode_brg = $pembelian['kode_barang']; + $barcode = $pembelian['barcode']; + $nomor = 1; + $nama_brg = addslashes($pembelian['nm_brg']); + $jumlah = $pembelian['jumlah']; + $subtotal = $pembelian['subtotal']; + $disc = $pembelian['disc']; + $discrp = $pembelian['discrp']; + $profit = $pembelian['profit']; + $ppn = $pembelian['ppn']; + $harga_pokok = $pembelian['harga_pokok']; + $harga_jual = $pembelian['harga_jual']; + $expdate = $pembelian['exp']; + $Insert_to_dbeli = $mysqli_dbeli->prepare("INSERT INTO `d_pembelian`( + `id`, + `no_faktur`, + `kode_barang`, + `nomor`, + `harga_satuan`, + `harga_pokok`, + `diskon`, + `diskonrp`, + `profit`, + `ppn`, + `kode_asli`, + `jum_fisik`, + `hj_final`, + `nm_brg`, + `exp_date` + ) + VALUES (NULL, '$nofaktur','$kode_brg',$nomor,'$subtotal','$harga_pokok', + '$disc','$discrp','$profit','$ppn','$barcode','$jumlah','$harga_jual', + '$nama_brg','$expdate')"); + $Insert_to_dbeli->execute(); + $id_gab = "A8".$kode_brg; + $Insert_to_dbeli = $mysqli_dbeli->prepare("UPDATE `no_barang` SET stok = stok + $jumlah, + harga_pokok = '$harga_pokok', harga_jual = '$harga_jual' + WHERE id_gabungan = '$id_gab'"); + $Insert_to_dbeli->execute(); + } + } +} + +function drop_temp(){ + $pemakai = $_SESSION["useracc"]; + $queryclear ="DROP TABLE IF EXISTS `tPembelian$pemakai`"; + runQuery($queryclear); +} + +?> + \ No newline at end of file diff --git a/old-source/ajaxrak.php b/old-source/ajaxrak.php new file mode 100644 index 0000000..82f926b --- /dev/null +++ b/old-source/ajaxrak.php @@ -0,0 +1,167 @@ + +prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function cari_rak($nama) { + $harray = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $nama = addslashes($nama); + $data = $mysqli->query("SELECT * FROM rak WHERE namaRak LIKE '%".$nama."%' ORDER BY idRak"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'idRak' => stripcslashes($a['idRak']), + 'namaRak' => $a['namaRak'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); +} + +function ambil_rak($id_rak) { + if ($id_rak != "") { + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM rak WHERE idRak = '".$id_rak."' ORDER BY idRak"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $array_data[$idx] = array( + 'idRak' => stripcslashes($a['idRak']), + 'namaRak' => $a['namaRak'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($array_data); + } +} + + + +function transaksi_rak($id_rak) { + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM rak WHERE idRak = '".$id_rak."'"); + if($data->num_rows > 0) { + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + /* update data rak */ + update_rak(); + } else { + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + /* simpan data rak baru */ + simpan_rak(); + } +} + +function update_rak(){ + if(isset($_POST)) { + $kode_rak = $_POST['koderak']; + $nama = $_POST['nama']; + + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $query = "UPDATE rak SET "; + $query .= "namaRak = ? "; + $query .= "WHERE idRak = ? "; + + $stmt = $mysqli->prepare($query); + $stmt->bind_param("si", $nama, $kode_rak); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function simpan_rak() { + $nama = $_POST['nama']; + + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $query = "INSERT INTO rak(namaRak) VALUES ('$nama')"; + $stmt = $mysqli->prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); +} +?> \ No newline at end of file diff --git a/old-source/ajaxsatuanbrg.php b/old-source/ajaxsatuanbrg.php new file mode 100644 index 0000000..dcf4d61 --- /dev/null +++ b/old-source/ajaxsatuanbrg.php @@ -0,0 +1,168 @@ + +prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function cari_satuanbrg($nama) { + $harray = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $nama = addslashes($nama); + $data = $mysqli->query("SELECT * FROM satuan_barang WHERE namaSatuanBarang LIKE '%".$nama."%' ORDER BY idSatuanBarang"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'idSatuanBarang' => stripcslashes($a['idSatuanBarang']), + 'namaSatuanBarang' => $a['namaSatuanBarang'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); +} + +function ambil_satuanbrg($id_satuanbrg) { + if ($id_satuanbrg != "") { + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM satuan_barang WHERE idSatuanBarang = '".$id_satuanbrg."' ORDER BY idSatuanBarang"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $array_data[$idx] = array( + 'idSatuanBarang' => stripcslashes($a['idSatuanBarang']), + 'namaSatuanBarang' => $a['namaSatuanBarang'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($array_data); + } +} + + + +function transaksi_satuanbrg($id_satuanbrg) { + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM satuan_barang WHERE idSatuanBarang = '".$id_satuanbrg."'"); + if($data->num_rows > 0) { + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + /* update data satuanbrg */ + update_satuanbrg(); + } else { + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + /* simpan data satuanbrg baru */ + simpan_satuanbrg(); + } +} + +function update_satuanbrg(){ + if(isset($_POST)) { + $idSatuanBarang = $_POST['kodesatuanbrg']; + $nama = $_POST['nama']; + + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $query = "UPDATE satuan_barang SET "; + $query .= "namaSatuanBarang = ? "; + $query .= "WHERE idSatuanBarang = ? "; + + $stmt = $mysqli->prepare($query); + $stmt->bind_param("si", $nama, $idSatuanBarang); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function simpan_satuanbrg() { + $idSatuanBarang = $_POST['kodesatuanbrg']; + $nama = $_POST['nama']; + + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $query = "INSERT INTO satuan_barang(namaSatuanBarang) VALUES ('$nama')"; + $stmt = $mysqli->prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); +} +?> \ No newline at end of file diff --git a/old-source/ajaxstrip.php b/old-source/ajaxstrip.php new file mode 100644 index 0000000..b454c43 --- /dev/null +++ b/old-source/ajaxstrip.php @@ -0,0 +1,250 @@ + +prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function cari_strip($nama) { + if($nama != "") { + $harray = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $nama = addslashes($nama); + $data = $mysqli->query("SELECT kd_strip, nama_strip, kel_jns FROM strip WHERE kd_strip LIKE '%".$nama."%' ORDER BY kd_strip"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_strip' => $a['kd_strip'], + 'nama_strip' => stripcslashes($a['nama_strip']), + 'kel_jns' => $a['kel_jns'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + }else{ + $harray = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $nama = addslashes($nama); + $data = $mysqli->query("SELECT kd_strip, nama_strip, kel_jns FROM strip ORDER BY kd_strip"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_strip' => $a['kd_strip'], + 'nama_strip' => stripcslashes($a['nama_strip']), + 'kel_jns' => $a['kel_jns'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function ambil_strip($id_strip) { + if ($id_strip != "") { + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM strip WHERE kd_strip = '".$id_strip."' ORDER BY kd_strip"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $array_data[$idx] = array( + 'kd_strip' => $a['kd_strip'], + 'nama_strip' => $a['nama_strip'], + 'murah1' => $a['murah1'], + 'murah2' => $a['murah2'], + 'sedang1' => $a['sedang1'], + 'sedang2' => $a['sedang2'], + 'mahal1' => $a['mahal1'], + 'mahal2' => $a['mahal2'], + 'benik_murah' => $a['benik_murah'], + 'benik_sedang' => $a['benik_sedang'], + 'benik_mahal' => $a['benik_mahal'], + 'kel_brg' => $a['kel_brg'], + 'kel_jns' => $a['kel_jns'], + 'persen_thiwul' => $a['persen_tiwul'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($array_data); + } +} + + + +function transaksi_strip($id_strip) { + if($id_strip != ""){ + // cek data + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT kd_strip FROM strip WHERE kd_strip = '".$id_strip."' ORDER BY kd_strip"); + if($data->num_rows > 0) { + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + /* update data strip */ + update_strip(); + } else { + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + /* simpan data strip baru */ + simpan_strip(); + } + } +} + +function update_strip(){ + if(isset($_POST)) { + $kode_strip = $_POST['kodestrip']; + $nama_strip = $_POST['namastrip']; + $murah1 = $_POST['murah1']; + $murah2 = $_POST['murah2']; + $sedang1 = $_POST['sedang1']; + $sedang2 = $_POST['sedang2']; + $mahal1 = $_POST['mahal1']; + $mahal2 = $_POST['mahal2']; + $benikmurah = $_POST['benikmurah']; + $beniksedang = $_POST['beniksedang']; + $benikmahal = $_POST['benikmahal']; + $kelbrg = $_POST['kelbrg']; + $keljns = $_POST['keljns']; + $thiwul = $_POST['thiwul']; + + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $query = "UPDATE strip SET "; + $query .= "nama_strip = ?, "; + $query .= "murah1 = ?, "; + $query .= "murah2 = ?, "; + $query .= "sedang1 = ?, "; + $query .= "sedang2 = ?, "; + $query .= "mahal1 = ?, "; + $query .= "mahal2 = ?, "; + $query .= "benik_murah = ?, "; + $query .= "benik_sedang = ?, "; + $query .= "benik_mahal = ?, "; + $query .= "kel_brg = ?, "; + $query .= "kel_jns = ?, "; + $query .= "persen_tiwul = ? "; + $query .= "WHERE kd_strip = ?"; + + $stmt = $mysqli->prepare($query); + $stmt->bind_param("siiiiiiiiissds", $nama_strip, $murah1, $murah2, $sedang1, $sedang2, $mahal1, + $mahal2, $benikmurah, $beniksedang, $benikmahal, $kelbrg, $keljns, $thiwul, $kode_strip); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function simpan_strip() { + if(isset($_POST)) { + $kode_strip = $_POST['kodestrip']; + $nama_strip = $_POST['namastrip']; + $murah1 = $_POST['murah1']; + $murah2 = $_POST['murah2']; + $sedang1 = $_POST['sedang1']; + $sedang2 = $_POST['sedang2']; + $mahal1 = $_POST['mahal1']; + $mahal2 = $_POST['mahal2']; + $benikmurah = $_POST['benikmurah']; + $beniksedang = $_POST['beniksedang']; + $benikmahal = $_POST['benikmahal']; + $kelbrg = $_POST['kelbrg']; + $keljns = $_POST['keljns']; + $thiwul = $_POST['thiwul']; + + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $query = "INSERT INTO strip VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + $stmt = $mysqli->prepare($query); + $stmt->bind_param("ssiiiiiiiiissd", $kode_strip, $nama_strip, $murah1, $murah2, $sedang1, $sedang2, $mahal1, + $mahal2, $benikmurah, $beniksedang, $benikmahal, $kelbrg, $keljns, $thiwul); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} +?> diff --git a/old-source/ajaxsuppbarang.php b/old-source/ajaxsuppbarang.php new file mode 100644 index 0000000..cda61aa --- /dev/null +++ b/old-source/ajaxsuppbarang.php @@ -0,0 +1,43 @@ + +prepare($query); + $stmt->bind_param("ssi", $kd_supplier, $lini, $ranking); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 2; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + } else{ + $array_data[0] = 3; + } + /* cetak hasil */ + echo json_encode($array_data); + +} +?> \ No newline at end of file diff --git a/old-source/ajaxsupplier.php b/old-source/ajaxsupplier.php new file mode 100644 index 0000000..fb8a255 --- /dev/null +++ b/old-source/ajaxsupplier.php @@ -0,0 +1,288 @@ + +prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function ambil_kode() { + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT MAX( kd_supplier ) + FROM supplier + WHERE kd_supplier NOT IN ('088888', '099998', '099999', '999999')"); + if($data->num_rows > 0) { + $a = $data->fetch_array(MYSQLI_NUM); + $kode_awal = $a[0]; + $kode = (int)$a[0] + 1; + $selisih = strlen($kode_awal) - strlen($kode); + for($i=0; $i<$selisih; $i++){ + $kode = '0'.$kode; + } + $array_data[0] = $kode; + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); +} + +function cari_supplier($nama) { + if($nama != "") { + $harray = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $nama = addslashes($nama); + $data = $mysqli->query("SELECT kd_supplier, nama_supplier, alamat1, lama_tempo FROM supplier WHERE nama_supplier LIKE '%".$nama."%'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_supplier' => $a['kd_supplier'], + 'nama_supplier' => stripcslashes($a['nama_supplier']), + 'alamat1' => $a['alamat1'], + 'lama_tempo' => $a['lama_tempo'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + }else{ + $harray = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $nama = addslashes($nama); + $data = $mysqli->query("SELECT kd_supplier, nama_supplier, alamat1, lama_tempo FROM supplier"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_supplier' => $a['kd_supplier'], + 'nama_supplier' => stripcslashes($a['nama_supplier']), + 'alamat1' => $a['alamat1'], + 'lama_tempo' => $a['lama_tempo'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function ambil_supplier($id_supplier) { + if ($id_supplier != "") { + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM supplier WHERE kd_supplier = '".$id_supplier."'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $array_data[$idx] = array( + 'kd_supplier' => $a['kd_supplier'], + 'nama_supplier' => $a['nama_supplier'], + 'alamat1' => $a['alamat1'], + 'alamat2' => $a['alamat2'], + 'nama_rekening' => $a['nama_rekening'], + 'rekening1' => $a['rekening1'], + 'rekening2' => $a['rekening2'], + 'bank1' => $a['bank1'], + 'bank2' => $a['bank2'], + 'telp' => $a['telp'], + 'ponsel' => $a['ponsel'], + 'email' => $a['email'], + 'fax' => $a['fax'], + 'jns_pembayaran' => $a['jns_pembayaran'], + 'lama_tempo' => $a['lama_tempo'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($array_data); + } +} + + + +function transaksi_supplier($id_supplier) { + if($id_supplier != ""){ + // cek data + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT kd_supplier FROM supplier WHERE kd_supplier = '".$id_supplier."'"); + if($data->num_rows > 0) { + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + /* update data supplier */ + update_supplier(); + } else { + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + /* simpan data supplier baru */ + simpan_supplier(); + } + } +} + +function update_supplier(){ + if(isset($_POST)) { + $kode_supplier = $_POST['kodesupplier']; + $supplier = $_POST['supplier']; + $alamat = $_POST['alamat']; + $namarek = $_POST['namarek']; + $rek = $_POST['rek']; + $bank = $_POST['bank']; + $alamat2 = $_POST['alamat2']; + $rek2 = $_POST['rek2']; + $bank2 = $_POST['bank2']; + $telp = $_POST['telp']; + $ponsel = $_POST['ponsel']; + $email = $_POST['email']; + $fax = $_POST['fax']; + $jenisbayar = $_POST['jenisbayar']; + $tempo = $_POST['tempo']; + + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $query = "UPDATE supplier SET "; + $query .= "nama_supplier = ?, "; + $query .= "alamat1 = ?, "; + $query .= "alamat2 = ?, "; + $query .= "nama_rekening = ?, "; + $query .= "rekening1 = ?, "; + $query .= "rekening2 = ?, "; + $query .= "bank1 = ?, "; + $query .= "bank2 = ?, "; + $query .= "telp = ?, "; + $query .= "ponsel = ?, "; + $query .= "email = ?, "; + $query .= "fax = ?, "; + $query .= "jns_pembayaran = ?, "; + $query .= "lama_tempo = ? "; + $query .= "WHERE kd_supplier = ?"; + + $stmt = $mysqli->prepare($query); + $stmt->bind_param("sssssssssssssis", $supplier, $alamat, $alamat2, $namarek, $rek, + $rek2, $bank, $bank2, $telp, $ponsel, $email, $fax, $jenisbayar, $tempo, $kode_supplier); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function simpan_supplier() { + if(isset($_POST)) { + $kode_supplier = $_POST['kodesupplier']; + $supplier = strtoupper($_POST['supplier']); + $alamat = strtoupper($_POST['alamat']); + $namarek = $_POST['namarek']; + $rek = $_POST['rek']; + $bank = $_POST['bank']; + $alamat2 = $_POST['alamat2']; + $rek2 = $_POST['rek2']; + $bank2 = $_POST['bank2']; + $telp = $_POST['telp']; + $ponsel = $_POST['ponsel']; + $email = $_POST['email']; + $fax = $_POST['fax']; + $jenisbayar = strtoupper($_POST['jenisbayar']); + $tempo = $_POST['tempo']; + + $array_data = array(); + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if($supplier != "" && $alamat != ""){ + $query = "INSERT INTO supplier VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + $stmt = $mysqli->prepare($query); + $stmt->bind_param("ssssssssssssssi", $kode_supplier, $supplier, $alamat, $alamat2, $namarek, $rek, $rek2, + $bank, $bank2, $telp, $ponsel, $email, $fax, $jenisbayar, $tempo); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + }else{ + $array_data[0] = 2; + } + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} +?> \ No newline at end of file diff --git a/old-source/ajaxtmpbeli.php b/old-source/ajaxtmpbeli.php new file mode 100644 index 0000000..8eb51a7 --- /dev/null +++ b/old-source/ajaxtmpbeli.php @@ -0,0 +1,82 @@ + +prepare("INSERT INTO `tPembelian$pemakai`( + `id`, + `kode_barang` , + `barcode` , + `nm_brg` , + `jumlah` , + `subtotal` , + `disc`, + `discrp`, + `profit`, + `ppn`, + `harga_pokok` , + `harga_jual`, + `exp` + ) + VALUES (NULL,'$kodebarang','$barcode','$nama','$jmlbeli','$subtotal','$disc','$discrp', + '$profit','$ppn','$hpbaru','$hjbaru','$expdate')"); + $dtInsert->execute(); + if($dtInsert->affected_rows > 0) { + $harray[0] = 1; + $dtInsert->close(); + } else { + $harray[0] = 0; + } + $mysqli->close(); + }else{ + $harray[0] = 2; + } + echo json_encode($harray); + +?> + \ No newline at end of file diff --git a/old-source/barang.php b/old-source/barang.php new file mode 100644 index 0000000..c8c9c26 --- /dev/null +++ b/old-source/barang.php @@ -0,0 +1,226 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Data Pengadaan Barang +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ID Barang: + + + +
Barcode: *
Nama barang: * +
Kode Supplier:
Group Product: + +
Sub Group Product: +
+ +

+
+ + +
+
+
Harga Pokok:
% Profit:
Harga Jual:
Pcs Max II:
Harga Jual II:
Pcs Max III:
Harga Jual III:
Satuan: + +
Stok Barang:

+ + +
+
+
+ +
+ +
+
Cari barang
+
+
+
+ + + + +
Barcode/Nama Brg:
+
+
+ Hasil pencarian +
+
+
+
+ +
+ + + diff --git a/old-source/barang_ambilgroup.php b/old-source/barang_ambilgroup.php new file mode 100644 index 0000000..6f64f9c --- /dev/null +++ b/old-source/barang_ambilgroup.php @@ -0,0 +1,29 @@ + +query("SELECT kd_strip,nama_strip FROM strip ORDER BY nama_strip"); +if($data->num_rows > 0) +{ + $idx = 0; + while($ket = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('kd_strip' => $ket['kd_strip'],'nama_strip' => $ket['nama_strip']); + $idx += 1; + } + /* tutup hasil query */ + $data->close(); +} +/* tutup koneksi */ +$mysqli->close(); +/* cetak hasil */ +echo json_encode($harray); diff --git a/old-source/barang_ambilsatuan.php b/old-source/barang_ambilsatuan.php new file mode 100644 index 0000000..c087e12 --- /dev/null +++ b/old-source/barang_ambilsatuan.php @@ -0,0 +1,29 @@ + +query("SELECT * FROM satuan_barang ORDER BY namaSatuanBarang"); +if($data->num_rows > 0) +{ + $idx = 0; + while($ket = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('idSatuanBarang' => $ket['idSatuanBarang'],'namaSatuanBarang' => $ket['namaSatuanBarang']); + $idx += 1; + } + /* tutup hasil query */ + $data->close(); +} +/* tutup koneksi */ +$mysqli->close(); +/* cetak hasil */ +echo json_encode($harray); diff --git a/old-source/barcoding/barcode.php b/old-source/barcoding/barcode.php new file mode 100644 index 0000000..0297824 --- /dev/null +++ b/old-source/barcoding/barcode.php @@ -0,0 +1,49 @@ +init(); // You must call this method to initialize the image +$drawing->add_barcode($code_generated); +$drawing->draw_all(); +$im = $drawing->get_im(); + +// Next line create the little picture, the barcode is being copied inside +$im2 = imagecreate($code_generated->lastX,$code_generated->lastY); +imagecopyresized($im2, $im, 0, 0, 0, 0, $code_generated->lastX, $code_generated->lastY, $code_generated->lastX, $code_generated->lastY); +$drawing->set_im($im2); + +// Header that says it is an image (remove it if you save the barcode to a file) +header('Content-Type: image/png'); + +// Draw (or save) the image into PNG format. +//$hasil = $drawing->finish(IMG_FORMAT_PNG); +$drawing->finish(IMG_FORMAT_PNG); +?> \ No newline at end of file diff --git a/old-source/barcoding/barcode_cari_barang.php b/old-source/barcoding/barcode_cari_barang.php new file mode 100644 index 0000000..64ba31f --- /dev/null +++ b/old-source/barcoding/barcode_cari_barang.php @@ -0,0 +1,111 @@ +query("SELECT b.kode_barang, b.nama_barang, nb.nomor,nb.harga_pokok,nb.harga_jual,nb.stok,dp.no_faktur,b.kode_supplier + FROM barang b, no_barang nb, d_pembelian dp, m_pembelian m + WHERE b.id_gabungan = nb.id_gabungan + AND (b.kode_barang = dp.kode_barang AND dp.nomor = nb.nomor) + AND dp.no_faktur = m.no_faktur + AND left(m.no_faktur,4) <> 'RVB-' + AND b.kode_barang = '$kodebarang' + AND b.nama_barang LIKE '%$namabarang%' + AND nb.nomor = '$nobarang' + ORDER BY b.kode_barang, nb.nomor"); + else if($kodebarang != "" && $namabarang != "" && $nobarang == "") + $data = $mysqli->query("SELECT b.kode_barang, b.nama_barang, nb.nomor,nb.harga_pokok,nb.harga_jual,nb.stok,dp.no_faktur,b.kode_supplier + FROM barang b, no_barang nb, d_pembelian dp, m_pembelian m + WHERE b.id_gabungan = nb.id_gabungan + AND (b.kode_barang = dp.kode_barang AND dp.nomor = nb.nomor) + AND dp.no_faktur = m.no_faktur + AND left(m.no_faktur,4) <> 'RVB-' + AND b.kode_barang = '$kodebarang' + AND b.nama_barang LIKE '%$namabarang%' + ORDER BY b.kode_barang, nb.nomor"); + else if($kodebarang != "" && $namabarang == "" && $nobarang != "") + $data = $mysqli->query("SELECT b.kode_barang, b.nama_barang, nb.nomor,nb.harga_pokok,nb.harga_jual,nb.stok,dp.no_faktur,b.kode_supplier + FROM barang b, no_barang nb, d_pembelian dp, m_pembelian m + WHERE b.id_gabungan = nb.id_gabungan + AND (b.kode_barang = dp.kode_barang AND dp.nomor = nb.nomor) + AND dp.no_faktur = m.no_faktur + AND left(m.no_faktur,4) <> 'RVB-' + AND b.kode_barang = '$kodebarang' + AND nb.nomor = '$nobarang' + ORDER BY b.kode_barang, nb.nomor"); + else if($kodebarang != "" && $namabarang == "" && $nobarang == "") + $data = $mysqli->query("SELECT b.kode_barang, b.nama_barang, nb.nomor,nb.harga_pokok,nb.harga_jual,nb.stok,dp.no_faktur,b.kode_supplier + FROM barang b, no_barang nb, d_pembelian dp, m_pembelian m + WHERE b.id_gabungan = nb.id_gabungan + AND (b.kode_barang = dp.kode_barang AND dp.nomor = nb.nomor) + AND dp.no_faktur = m.no_faktur + AND left(m.no_faktur,4) <> 'RVB-' + AND b.kode_barang = '$kodebarang' + ORDER BY b.kode_barang, nb.nomor"); + else if($kodebarang == "" && $namabarang != "" && $nobarang != "") + $data = $mysqli->query("SELECT b.kode_barang, b.nama_barang, nb.nomor,nb.harga_pokok,nb.harga_jual,nb.stok,dp.no_faktur,b.kode_supplier + FROM barang b, no_barang nb, d_pembelian dp, m_pembelian m + WHERE b.id_gabungan = nb.id_gabungan + AND (b.kode_barang = dp.kode_barang AND dp.nomor = nb.nomor) + AND dp.no_faktur = m.no_faktur + AND left(m.no_faktur,4) <> 'RVB-' + AND b.nama_barang LIKE '%$namabarang%' + AND nb.nomor = '$nobarang' + ORDER BY b.kode_barang, nb.nomor"); + else if($kodebarang == "" && $namabarang != "" && $nobarang == "") + $data = $mysqli->query("SELECT b.kode_barang, b.nama_barang, nb.nomor,nb.harga_pokok,nb.harga_jual,nb.stok,dp.no_faktur,b.kode_supplier + FROM barang b, no_barang nb, d_pembelian dp, m_pembelian m + WHERE b.id_gabungan = nb.id_gabungan + AND (b.kode_barang = dp.kode_barang AND dp.nomor = nb.nomor) + AND dp.no_faktur = m.no_faktur + AND left(m.no_faktur,4) <> 'RVB-' + AND b.nama_barang LIKE '%$namabarang%' + ORDER BY b.kode_barang, nb.nomor"); + else if($kodebarang == "" && $namabarang == "" && $nobarang != "") + $data = $mysqli->query("SELECT b.kode_barang, b.nama_barang, nb.nomor,nb.harga_pokok,nb.harga_jual,nb.stok,dp.no_faktur,b.kode_supplier + FROM barang b, no_barang nb, d_pembelian dp, m_pembelian m + WHERE b.id_gabungan = nb.id_gabungan + AND (b.kode_barang = dp.kode_barang AND dp.nomor = nb.nomor) + AND dp.no_faktur = m.no_faktur + AND left(m.no_faktur,4) <> 'RVB-' + AND nb.nomor = '$nobarang' + ORDER BY b.kode_barang, nb.nomor"); + + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + // dibenerin ya... + // tidak di loop lagi. + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('kode_barang' => $a['kode_barang'], 'nama_barang' => $a['nama_barang'], 'kode_toko' => $a['no_faktur'], 'no_barang' => $a['nomor'], + 'HP'=> $a['harga_pokok'], 'HJ'=>$a['harga_jual'], 'stok'=>$a['stok'], 'kdsupp' => $a['kode_supplier']); + $idx++; + + $faktur = ""; + } + /* tutup hasil query */ + $data->close(); + + } + /* tutup koneksi */ + $mysqli->close(); + + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/barcoding/barcode_cari_barang.php~ b/old-source/barcoding/barcode_cari_barang.php~ new file mode 100644 index 0000000..0167a5b --- /dev/null +++ b/old-source/barcoding/barcode_cari_barang.php~ @@ -0,0 +1,97 @@ +query("SELECT DISTINCT b.kode_barang, b.nama_barang, nb.nomor,nb.harga_pokok,nb.harga_jual,nb.stok,dp.no_faktur,b.kode_supplier + FROM barang b, no_barang nb, d_pembelian dp, m_pembelian m + WHERE b.id_gabungan = nb.id_gabungan AND b.kode_barang = dp.kode_barang + AND dp.no_faktur = m.no_faktur + AND m.referensi = '' + AND b.kode_barang LIKE '%$kodebarang%' + AND b.nama_barang LIKE '%$namabarang%' + AND nb.nomor LIKE '%$nobarang%'"); + else if($kodebarang != "" && $namabarang != "" && $nobarang == "") + $data = $mysqli->query("SELECT DISTINCT b.kode_barang, b.nama_barang, nb.nomor,nb.harga_pokok,nb.harga_jual,nb.stok,dp.no_faktur,b.kode_supplier + FROM barang b, no_barang nb, d_pembelian dp + WHERE b.id_gabungan = nb.id_gabungan AND b.kode_barang = dp.kode_barang + AND dp.no_faktur = m.no_faktur + AND m.referensi = '' + AND b.kode_barang LIKE '%$kodebarang%' + AND b.nama_barang LIKE '%$namabarang%'"); + else if($kodebarang != "" && $namabarang == "" && $nobarang != "") + $data = $mysqli->query("SELECT DISTINCT b.kode_barang, b.nama_barang, nb.nomor,nb.harga_pokok,nb.harga_jual,nb.stok,dp.no_faktur,b.kode_supplier + FROM barang b, no_barang nb, d_pembelian dp + WHERE b.id_gabungan = nb.id_gabungan AND b.kode_barang = dp.kode_barang + AND dp.no_faktur = m.no_faktur + AND m.referensi = '' + AND b.kode_barang LIKE '%$kodebarang%' + AND nb.nomor LIKE '%$nobarang%'"); + else if($kodebarang != "" && $namabarang == "" && $nobarang == "") + $data = $mysqli->query("SELECT DISTINCT b.kode_barang, b.nama_barang, nb.nomor,nb.harga_pokok,nb.harga_jual,nb.stok,dp.no_faktur,b.kode_supplier + FROM barang b, no_barang nb, d_pembelian dp + WHERE b.id_gabungan = nb.id_gabungan AND b.kode_barang = dp.kode_barang + AND dp.no_faktur = m.no_faktur + AND m.referensi = '' + AND b.kode_barang LIKE '%$kodebarang%'"); + else if($kodebarang == "" && $namabarang != "" && $nobarang != "") + $data = $mysqli->query("SELECT DISTINCT b.kode_barang, b.nama_barang, nb.nomor,nb.harga_pokok,nb.harga_jual,nb.stok,dp.no_faktur,b.kode_supplier + FROM barang b, no_barang nb, d_pembelian dp + WHERE b.id_gabungan = nb.id_gabungan AND b.kode_barang = dp.kode_barang + AND dp.no_faktur = m.no_faktur + AND m.referensi = '' + AND b.nama_barang LIKE '%$namabarang%' + AND nb.nomor LIKE '%$nobarang%'"); + else if($kodebarang == "" && $namabarang != "" && $nobarang == "") + $data = $mysqli->query("SELECT DISTINCT b.kode_barang, b.nama_barang, nb.nomor, nb.harga_pokok,nb.harga_jual,nb.stok,dp.no_faktur,b.kode_supplier + FROM barang b, no_barang nb, d_pembelian dp + WHERE b.id_gabungan = nb.id_gabungan AND b.kode_barang = dp.kode_barang + AND dp.no_faktur = m.no_faktur + AND m.referensi = '' + AND b.nama_barang LIKE '%$namabarang%'"); + else if($kodebarang == "" && $namabarang == "" && $nobarang != "") + $data = $mysqli->query("SELECT DISTINCT b.kode_barang, b.nama_barang, nb.nomor,nb.harga_pokok,nb.harga_jual,nb.stok,dp.no_faktur,b.kode_supplier + FROM barang b, no_barang nb, d_pembelian dp + WHERE b.id_gabungan = nb.id_gabungan AND b.kode_barang = dp.kode_barang + AND dp.no_faktur = m.no_faktur + AND m.referensi = '' + AND nb.nomor LIKE '%$nobarang%'"); + + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + // dibenerin ya... + // tidak di loop lagi. + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('kode_barang' => $a['kode_barang'], 'nama_barang' => $a['nama_barang'], 'kode_toko' => $a['no_faktur'], 'no_barang' => $a['nomor'], + 'HP'=> $a['harga_pokok'], 'HJ'=>$a['harga_jual'], 'stok'=>$a['stok'], 'kdsupp' => $a['kode_supplier']); + $idx++; + + $faktur = ""; + } + /* tutup hasil query */ + $data->close(); + + } + /* tutup koneksi */ + $mysqli->close(); + + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/barcoding/barcode_form.php b/old-source/barcoding/barcode_form.php new file mode 100644 index 0000000..b4add15 --- /dev/null +++ b/old-source/barcoding/barcode_form.php @@ -0,0 +1,249 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ Pilih Sumber Data + + + + + + + + +
Nomor Faktur
Nomor Faktur : +
Kode Barang
Kode Barang : +
Nomor Barang :
Jumlah Cetak :
+ +
+ + + +
+
+
+ +
+ + +
+

+
+ +
+ + + + + + + + + + + +
Nomor Faktur:
Rentang Tanggal: + s/d + +
Kode Supplier:
+
+ Hasil pencarian +
+
+
+ +
+ + + + + + + + + + +
Kode Barang:
Nama Barang:
Nomor Barang:
+
+ Hasil pencarian +
+
+
+ + + + +"); + print("
"); + print("
"); + print(""); + print("
"); + print("
"); +} + +?> \ No newline at end of file diff --git a/old-source/barcoding/barcode_hasil (copy).php b/old-source/barcoding/barcode_hasil (copy).php new file mode 100644 index 0000000..94ea81d --- /dev/null +++ b/old-source/barcoding/barcode_hasil (copy).php @@ -0,0 +1,80 @@ + + + + +"); + print("
"); + print("
".strtoupper($namabr)."
"); + print("
Rp. ".number_format($hjual,0,',','.')."
"); + print("
"); + $string = $string.$barcode.",".strtoupper($namabr).",".number_format($hjual,0,',','.')."\n"; + } +} +else if(isset($_POST["fkodebarang"]) && isset($_POST["fjml"]) && isset($_POST["count"])) +{ + $kode = $_POST["fkodebarang"]; + $namabr = $_POST["fnamabarang"]; + $nomor = $_POST["fnomor"]; + $jumlah = $_POST["fjml"]; + $hjual = $_POST["fhjual"]; + $count = $_POST["count"]; + + for($i = 0; $i<$count; $i++) + { + $barcode = $kode[$i]; + for($j = 0; $j<$jumlah[$i]; $j++) + { + print("
"); + print("
"); + print("
".strtoupper($namabr[$i])."
"); + print("
Rp. ".number_format($hjual[$i],0,',','.')."
"); + print("

"); + $string = $string.$barcode.",".strtoupper($namabr[$i]).",".number_format($hjual[$i],0,',','.')."\n"; + } + } +} + +createFile(substr($string,0,-1)); + +function createFile($contentAdd) + { + $filename = '../data/barcode_cetak.csv'; + + $handle = fopen($filename,"wt"); + $somecontent = $contentAdd."\n"; + fwrite($handle,$somecontent); + fclose($handle); + + } + +?> diff --git a/old-source/barcoding/barcode_hasil.php b/old-source/barcoding/barcode_hasil.php new file mode 100644 index 0000000..c39b253 --- /dev/null +++ b/old-source/barcoding/barcode_hasil.php @@ -0,0 +1,138 @@ + + + + + $label_per_baris) { + $kolom = 1; + $baris++; + $clear = " clear:left; "; + }; + if ($baris > $baris_per_halaman) { + $baris = 1; + echo '

'; + }; + + $namaBarang = $namabr; + + // cetak label + echo "\n + +

+ +
+
+
".strtoupper($namaBarang)."
+
Rp. ".number_format($hjual,0,',','.')."
+
+ +
+ "; + + $kolom++; + } // end for + +} +else if(isset($_POST["fkodebarang"]) && isset($_POST["fjml"]) && isset($_POST["count"])) +{ + $kode = $_POST["fkodebarang"]; + $namabr = $_POST["fnamabarang"]; + $nomor = $_POST["fnomor"]; + $jumlah = $_POST["fjml"]; + $hjual = $_POST["fhjual"]; + $count = $_POST["count"]; + $lebar_label = 175; + $tinggi_label = 90; + $label_per_baris = 3; + $baris_per_halaman = 7; + $baris=1; $kolom=1; + + for($i = 0; $i<$count; $i++) + { + $barcode = $kode[$i]; + $namaBarang = $namabr[$i]; + $hrgjual = $hjual[$i]; + for($j = 0; $j<$jumlah[$i]; $j++) + { + $clear = ""; + // cek posisi saat ini + if ($kolom > $label_per_baris) { + $kolom = 1; + $baris++; + $clear = " clear:left; "; + }; + if ($baris > $baris_per_halaman) { + $baris = 1; + echo '

'; + }; + + // cetak label + echo "\n + +

+ +
+
+
".strtoupper($namaBarang)."
+
Rp. ".number_format($hrgjual,0,',','.')."
+
+ +
+ "; + + $kolom++; + } // end for + + } +} + + +?> diff --git a/old-source/barcoding/barcode_hasil2.php b/old-source/barcoding/barcode_hasil2.php new file mode 100644 index 0000000..6a66cc6 --- /dev/null +++ b/old-source/barcoding/barcode_hasil2.php @@ -0,0 +1,130 @@ + + + + + $label_per_baris) { + $kolom = 1; + $baris++; + $clear = " clear:left; "; + }; + if ($baris > $baris_per_halaman) { + $baris = 1; + echo '

'; + }; + + $namaBarang = $namabr; + + // cetak label + echo "\n + +

+ +
+
+
".strtoupper($namaBarang)."
+
Rp. ".number_format($hjual,0,',','.')."
+
+ +
+ "; + + $kolom++; + } // end for + +} +else if(isset($_POST["fkodebarang"]) && isset($_POST["fjml"]) && isset($_POST["count"])) +{ + $kode = $_POST["fkodebarang"]; + $namabr = $_POST["fnamabarang"]; + $nomor = $_POST["fnomor"]; + $jumlah = $_POST["fjml"]; + $hjual = $_POST["fhjual"]; + $count = $_POST["count"]; + + for($i = 0; $i<$count; $i++) + { + $barcode = $kode[$i]; + $namaBarang = $namabr[$i]; + $hrgjual = $hjual[$i]; + for($j = 1; $j<=1; $j++) + { + $clear = ""; + // cek posisi saat ini + if ($kolom > $label_per_baris) { + $kolom = 1; + $baris++; + $clear = " clear:left; "; + }; + if ($baris > $baris_per_halaman) { + $baris = 1; + echo '

'; + }; + + // cetak label + echo "\n + +

+ +
+
+
".strtoupper($namaBarang)."
+
Rp. ".number_format($hrgjual,0,',','.')."
+
+ +
+ "; + + $kolom++; + } // end for + } +} + + +?> diff --git a/old-source/barcoding/barcode_kbarang.php b/old-source/barcoding/barcode_kbarang.php new file mode 100644 index 0000000..e93d042 --- /dev/null +++ b/old-source/barcoding/barcode_kbarang.php @@ -0,0 +1,50 @@ +query("SELECT br.kode_lama, br.nama_barang, nb.id_gabungan, nb.harga_jual + FROM barang br, no_barang nb + WHERE br.id_gabungan = nb.id_gabungan + AND br.kode_barang = '$_REQUEST[kode]' + AND nb.nomor = '$_REQUEST[nomor]' + GROUP BY nb.id_gabungan + "); + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'barcode_asli' => $a['kode_lama'], + 'nama_barang' => $a['nama_barang'], + 'harga_jual' => $a['harga_jual'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/barcoding/barcode_nota.php b/old-source/barcoding/barcode_nota.php new file mode 100644 index 0000000..3c88e0e --- /dev/null +++ b/old-source/barcoding/barcode_nota.php @@ -0,0 +1,51 @@ +query("SELECT dp.kode_barang, dp.nomor, dp.jumlah, dp.hj_final, br.nama_barang + FROM d_pembelian dp, barang br + WHERE dp.kode_barang = br.kode_barang AND dp.no_faktur = '$_REQUEST[nota]'"); + */ + $data = $mysqli->query("SELECT dp.kode_barang, dp.kode_asli, dp.nomor, dp.jum_fisik, dp.hj_final, dp.nm_brg + FROM d_pembelian dp + WHERE dp.no_faktur = '$_REQUEST[nota]' + ORDER BY dp.kode_barang,dp.nm_brg,dp.nomor + "); + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'], + 'kode_asli' => $a['kode_asli'], + 'nama_barang' => $a['nm_brg'], + 'nomor' => $a['nomor'], + 'jumlah' => $a['jum_fisik'], + 'harga_jual' => $a['hj_final'] + ); + $idx++; + } + } + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/barcoding/class_barcode/BarCode.php b/old-source/barcoding/class_barcode/BarCode.php new file mode 100644 index 0000000..034f3a0 --- /dev/null +++ b/old-source/barcoding/class_barcode/BarCode.php @@ -0,0 +1,128 @@ +maxHeight = $maxHeight; + $this->color1 = $color1; + $this->color2 = $color2; + $this->res = $res; + $this->error = 0; + $this->positionY = 0; + } + + /** + * Returns the index in $keys (useful for checksum) + * + * @param mixed $var + * @return mixed + */ + protected function findIndex($var){ + return array_search($var,$this->keys); + } + + /** + * Returns the code of the char (useful for drawing bars) + * + * @param mixed $var + * @return string + */ + protected function findCode($var){ + return $this->code[$this->findIndex($var)]; + } + + /** + * Draws a Bar of $color depending of the resolution + * + * @param ressource $img + * @param FColor $color + */ + protected function DrawSingleBar($im,FColor $color){ + $bar_color = (is_null($color))?NULL:$color->allocate($im); + if(!is_null($bar_color)) + for($i=0;$i<$this->res;$i++) + imageline($im,$this->positionX+$i,$this->positionY,$this->positionX+$i,$this->positionY+$this->maxHeight,$bar_color); + } + + /** + * Writes the Error on the picture + * + * @param ressource $img + * @param string $text + */ + protected function DrawError($im,$text){ + $text_color = (is_null($this->color1))?NULL:$this->color1->allocate($im); + imagestring($im,5,0,$this->error*15,$text,$text_color); + $this->error++; + $this->lastX = (imagefontwidth(5)*strlen($text)>$this->lastX)?imagefontwidth(5)*strlen($text):$this->lastX; + $this->lastY = $this->error*15; + } + + /** + * Moving the pointer right to write a bar + */ + protected function nextX(){ + $this->positionX+=$this->res; + } + + /** + * Draws all chars thanks to $code. if $start==1, the line begins by a bar. + * if $start==2, the line begins by a space. + * + * @param ressource $im + * @param string $code + * @param int $start + */ + protected function DrawChar($im,$code,$start=1){ + $currentColor = ($start==1)?$this->color1:$this->color2; + $colornumber = $start; + for($i=0;$iDrawSingleBar($im,$currentColor); + $this->nextX(); + } + if($colornumber==1){ + $currentColor=$this->color2; + $colornumber=2; + } + else{ + $currentColor=$this->color1; + $colornumber=1; + } + } + } + + /** + * Draws the label under the barcode + * + * @param ressource $im + */ + protected function DrawText($im) { + if($this->textfont != 0) { + $xPosition = ($this->positionX / 2) - (strlen($this->text)/2)*imagefontwidth($this->textfont); + $text_color = (is_null($this->color1))?NULL:$this->color1->allocate($im); + imagestring($im,$this->textfont,$xPosition,$this->maxHeight,$this->text,$text_color); + $this->lastY = $this->maxHeight + imagefontheight($this->textfont); + } + } +}; +?> \ No newline at end of file diff --git a/old-source/barcoding/class_barcode/FColor.php b/old-source/barcoding/class_barcode/FColor.php new file mode 100644 index 0000000..fa92e4f --- /dev/null +++ b/old-source/barcoding/class_barcode/FColor.php @@ -0,0 +1,59 @@ +r = $r; + $this->g = $g; + $this->b = $b; + } + + /** + * Returns Red Color + * + * @return int + */ + public function r(){ + return $this->r; + } + + /** + * Returns Green Color + * + * @return int + */ + public function g(){ + return $this->g; + } + + /** + * Returns Blue Color + * + * @return int + */ + public function b(){ + return $this->b; + } + + /** + * Returns the int value for PHP color + * + * @return int + */ + public function allocate($im) { + return imagecolorallocate($im,$this->r,$this->g,$this->b); + } +}; +?> \ No newline at end of file diff --git a/old-source/barcoding/class_barcode/FDrawing.php b/old-source/barcoding/class_barcode/FDrawing.php new file mode 100644 index 0000000..7c174e0 --- /dev/null +++ b/old-source/barcoding/class_barcode/FDrawing.php @@ -0,0 +1,98 @@ +w = $w; + $this->h = $h; + $this->filename = $filename; + $this->color = $color; + } + + /** + * Destructor + */ + public function __destruct() { + $this->destroy(); + } + + /** + * Init Image and color background + */ + public function init(){ + $this->im = imagecreate($this->w, $this->h) + or die('Can\'t Initialize the GD Libraty'); + imagecolorallocate($this->im,$this->color->r(),$this->color->g(),$this->color->b()); + } + + /** + * @return ressource + */ + public function get_im() { + return $this->im; + } + public function set_im($im) { + $this->im = $im; + } + + /** + * Add barcode into the drawing array (for future drawing) + * + * @param BarCode $barcode + */ + public function add_barcode(BarCode $barcode) { + $this->barcode[] = $barcode; + } + + /** + * Draw first all forms and after all texts on $im + */ + public function draw_all() { + for($i=0;$ibarcode);$i++) + $this->barcode[$i]->draw($this->im); + } + + /** + * Save $im into the file (many format available) + * + * @param int $image_style + * @param int $quality + */ + public function finish($image_style=IMG_FORMAT_PNG,$quality=100) { + if($image_style==constant('IMG_FORMAT_PNG')){ + if(empty($this->filename)) + imagepng($this->im); + else + imagepng($this->im,$this->filename); + } + elseif($image_style==constant('IMG_FORMAT_JPEG')) + imagejpeg($this->im,$this->filename,$quality); + } + + /** + * Free the memory of PHP (called also by destructor) + */ + public function destroy() { + imagedestroy($this->im); + } +}; +?> \ No newline at end of file diff --git a/old-source/barcoding/class_barcode/bar128.php b/old-source/barcoding/class_barcode/bar128.php new file mode 100644 index 0000000..5a40a45 --- /dev/null +++ b/old-source/barcoding/class_barcode/bar128.php @@ -0,0 +1,52 @@ + + + +?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'; +$char128wid = array( + '212222','222122','222221','121223','121322','131222','122213','122312','132212','221213', // 0-9 + '221312','231212','112232','122132','122231','113222','123122','123221','223211','221132', // 10-19 + '221231','213212','223112','312131','311222','321122','321221','312212','322112','322211', // 20-29 + '212123','212321','232121','111323','131123','131321','112313','132113','132311','211313', // 30-39 + '231113','231311','112133','112331','132131','113123','113321','133121','313121','211331', // 40-49 + '231131','213113','213311','213131','311123','311321','331121','312113','312311','332111', // 50-59 + '314111','221411','431111','111224','111422','121124','121421','141122','141221','112214', // 60-69 + '112412','122114','122411','142112','142211','241211','221114','413111','241112','134111', // 70-79 + '111242','121142','121241','114212','124112','124211','411212','421112','421211','212141', // 80-89 + '214121','412121','111143','111341','131141','114113','114311','411113','411311','113141', // 90-99 + '114131','311141','411131','211412','211214','211232','23311120' ); // 100-106 + +////Define Function +function bar128($text) { // Part 1, make list of widths + global $char128asc,$char128wid; + $w = $char128wid[$sum = 104]; // START symbol + $onChar=1; + for($x=0;$x"; + //return "$html$text"; + return "$html"; +} \ No newline at end of file diff --git a/old-source/barcoding/class_barcode/code128.barcode.php b/old-source/barcoding/class_barcode/code128.barcode.php new file mode 100644 index 0000000..76004b9 --- /dev/null +++ b/old-source/barcoding/class_barcode/code128.barcode.php @@ -0,0 +1,306 @@ +starting = 103; + elseif($start=='B') + $this->starting = 104; + elseif($start=='C') + $this->starting = 105; + $this->ending = 106; + $this->currentCode = $start; + /* CODE 128 A */ + $this->keysA = array(' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/','0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?','@','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','[','\\',']','^','_','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',chr(128),chr(129)); + + /* CODE 128 B */ + $this->keysB = array(' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/','0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?','@','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','[','\\',']','^','_','`','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','{','|','}','~','','','','',chr(128),'',chr(130)); + + /* CODE 128 C */ + $this->keysC = array(); + for($i=0;$i<=99;$i++) + $this->keysC[] = sprintf('%02d',$i); + $this->keysC[] = chr(129); + $this->keysC[] = chr(130); + + $this->code = array( + '101111', /* 00 */ + '111011', /* 01 */ + '111110', /* 02 */ + '010112', /* 03 */ + '010211', /* 04 */ + '020111', /* 05 */ + '011102', /* 06 */ + '011201', /* 07 */ + '021101', /* 08 */ + '110102', /* 09 */ + '110201', /* 10 */ + '120101', /* 11 */ + '001121', /* 12 */ + '011021', /* 13 */ + '011120', /* 14 */ + '002111', /* 15 */ + '012011', /* 16 */ + '012110', /* 17 */ + '112100', /* 18 */ + '110021', /* 19 */ + '110120', /* 20 */ + '102101', /* 21 */ + '112001', /* 22 */ + '201020', /* 23 */ + '200111', /* 24 */ + '210011', /* 25 */ + '210110', /* 26 */ + '201101', /* 27 */ + '211001', /* 28 */ + '211100', /* 29 */ + '101012', /* 30 */ + '101210', /* 31 */ + '121010', /* 32 */ + '000212', /* 33 */ + '020012', /* 34 */ + '020210', /* 35 */ + '001202', /* 36 */ + '021002', /* 37 */ + '021200', /* 38 */ + '100202', /* 39 */ + '120002', /* 40 */ + '120200', /* 41 */ + '001022', /* 42 */ + '001220', /* 43 */ + '021020', /* 44 */ + '002012', /* 45 */ + '002210', /* 46 */ + '022010', /* 47 */ + '202010', /* 48 */ + '100220', /* 49 */ + '120020', /* 50 */ + '102002', /* 51 */ + '102200', /* 52 */ + '102020', /* 53 */ + '200012', /* 54 */ + '200210', /* 55 */ + '220010', /* 56 */ + '201002', /* 57 */ + '201200', /* 58 */ + '221000', /* 59 */ + '203000', /* 60 */ + '110300', /* 61 */ + '320000', /* 62 */ + '000113', /* 63 */ + '000311', /* 64 */ + '010013', /* 65 */ + '010310', /* 66 */ + '030011', /* 67 */ + '030110', /* 68 */ + '001103', /* 69 */ + '001301', /* 70 */ + '011003', /* 71 */ + '011300', /* 72 */ + '031001', /* 73 */ + '031100', /* 74 */ + '130100', /* 75 */ + '110003', /* 76 */ + '302000', /* 77 */ + '130001', /* 78 */ + '023000', /* 79 */ + '000131', /* 80 */ + '010031', /* 81 */ + '010130', /* 82 */ + '003101', /* 83 */ + '013001', /* 84 */ + '013100', /* 85 */ + '300101', /* 86 */ + '310001', /* 87 */ + '310100', /* 88 */ + '101030', /* 89 */ + '103010', /* 90 */ + '301010', /* 91 */ + '000032', /* 92 */ + '000230', /* 93 */ + '020030', /* 94 */ + '003002', /* 95 */ + '003200', /* 96 */ + '300002', /* 97 */ + '300200', /* 98 */ + '002030', /* 99 */ + '003020', /* 100*/ + '200030', /* 101*/ + '300020', /* 102*/ + '100301', /* 103*/ + '100103', /* 104*/ + '100121', /* 105*/ + '122000' /*STOP*/ + ); + $this->setText($text); + $this->textfont = $textfont; + $this->usingCode($start); + $this->starting_text = $start; + } + + /** + * Saves Text + * + * @param string $text + */ + public function setText($text) { + $this->text = $text; + } + + private function usingCode($code) { + if($code=='A') + $this->keys = $this->keysA; + elseif($code=='B') + $this->keys = $this->keysB; + elseif($code=='C') + $this->keys = $this->keysC; + $this->currentCode = $code; + } + + /** + * Draws the barcode + * + * @param ressource $im + */ + public function draw($im) { + $error_stop = false; + + $this->usingCode($this->starting_text); + // Checking if all chars are allowed + for($i=0;$itext);$i++) { + if($this->currentCode=='C') { + if(isset($this->text[$i+1]) && $this->check_int($this->text[$i+1])) { + $value_test = array_search($this->text[$i].$this->text[$i+1],$this->keys); + $i++; + } + else { + $this->DrawError($im,'With Code C, you must provide always pair of two integers.'); + $error_stop = true; + } + } + else + $value_test = array_search($this->text[$i],$this->keys); + if(!is_int($value_test)) { + $this->DrawError($im,'Char \''.$this->text[$i].'\' not allowed.'); + $error_stop = true; + } + if($this->findIndex($this->text[$i]) == 99 && $this->currentCode != 'C') + $this->usingCode('C'); + elseif($this->findIndex($this->text[$i]) == 100 && $this->currentCode != 'B') + $this->usingCode('B'); + elseif($this->findIndex($this->text[$i]) == 101 && $this->currentCode != 'A') + $this->usingCode('A'); + } + if($error_stop == false) { + // The START-A, START-B, START-C, STOP are not allowed + if(is_int(strpos($this->text,chr(135))) || is_int(strpos($this->text,chr(136))) || is_int(strpos($this->text,chr(137))) || is_int(strpos($this->text,chr(138)))) { + $this->DrawError($im,'Chars START-A, START-B, START-C, STOP not allowed.'); + $error_stop = true; + } + if($error_stop == false) { + $this->usingCode($this->starting_text); + // Starting Code + $this->DrawChar($im,$this->code[$this->starting],1); + // Chars + for($i=0;$itext);$i++) { + if($this->currentCode=='C') { + $this->DrawChar($im,$this->findCode($this->text[$i].$this->text[$i+1]),1); + $i++; + } + else + $this->DrawChar($im,$this->findCode($this->text[$i]),1); + if($this->findIndex($this->text[$i]) == 99 && $this->currentCode != 'C') + $this->usingCode('C'); + elseif($this->findIndex($this->text[$i]) == 100 && $this->currentCode != 'B') + $this->usingCode('B'); + elseif($this->findIndex($this->text[$i]) == 101 && $this->currentCode != 'A') + $this->usingCode('A'); + } + // Checksum + // First Char (START) + // + Starting with the first data character following the start character, + // take the value of the character (between 0 and 102, inclusive) multiply + // it by its character position (1) and add that to the running checksum. + // Modulated 103 + if($this->starting == 103) + $this->usingCode('A'); + elseif($this->starting == 104) + $this->usingCode('B'); + elseif($this->starting == 105) + $this->usingCode('C'); + $checksum = 0; + $checksum += $this->starting; + for($position=1,$i=0;$itext);$position++,$i++) { + if($this->currentCode=='C') { + $checksum += intval($this->text[$i].$this->text[$i+1]) * $position; + $i++; + } + else + $checksum += $this->findIndex($this->text[$i]) * $position; + + if($this->findIndex($this->text[$i]) == 99 && $this->currentCode != 'C') + $this->usingCode('C'); + elseif($this->findIndex($this->text[$i]) == 100 && $this->currentCode != 'B') + $this->usingCode('B'); + elseif($this->findIndex($this->text[$i]) == 101 && $this->currentCode != 'A') + $this->usingCode('A'); + } + $this->DrawChar($im,$this->code[$checksum % 103],1); + // Ending Code + $this->DrawChar($im,$this->code[$this->ending],1); + // Draw a Final Bar + $this->DrawChar($im,'1',1); + $this->lastX = $this->positionX; + $this->lastY = $this->maxHeight; + // Removing Special Code + $this->text = ereg_replace(chr(128),'',$this->text); + $this->text = ereg_replace(chr(129),'',$this->text); + $this->text = ereg_replace(chr(130),'',$this->text); + $this->DrawText($im); + } + } + } + + private function check_int($var) { + if(intval($var)>=0 || intval($var)<=9) + return true; + else + return false; + } +}; +?> \ No newline at end of file diff --git a/old-source/barcoding/class_barcode/index.php b/old-source/barcoding/class_barcode/index.php new file mode 100644 index 0000000..0a68ec2 --- /dev/null +++ b/old-source/barcoding/class_barcode/index.php @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/old-source/barcoding/down.php b/old-source/barcoding/down.php new file mode 100644 index 0000000..13daee6 --- /dev/null +++ b/old-source/barcoding/down.php @@ -0,0 +1,19 @@ + diff --git a/old-source/barcoding/hmenu.php~ b/old-source/barcoding/hmenu.php~ new file mode 100644 index 0000000..82270dc --- /dev/null +++ b/old-source/barcoding/hmenu.php~ @@ -0,0 +1,128 @@ + diff --git a/old-source/barcoding/lapdisp.php b/old-source/barcoding/lapdisp.php new file mode 100644 index 0000000..a092365 --- /dev/null +++ b/old-source/barcoding/lapdisp.php @@ -0,0 +1,218 @@ + + +"; + echo "div#divprint{width:1024px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:950px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:50px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = $_POST['kdsupp']; + $endDate = $_POST['endDate']; + + + if(bukaKoneksi()){ + global $conn; + IF ($startDate != '' && $endDate != ''){ + + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ + FROM barang b,no_barang n, d_pembelian d + WHERE n.stok < 0 + and b.id_gabungan = n.id_gabungan + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_supplier = '$startDate' + and b.kode_strip = '$endDate' + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + }elseif ($startDate == '' && $endDate != ''){ + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ + FROM barang b,no_barang n, d_pembelian d + WHERE n.stok < 0 + and b.id_gabungan = n.id_gabungan + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_strip = '$endDate' + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + }else { + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ + FROM barang b,no_barang n, d_pembelian d + WHERE n.stok < 0 + and b.id_gabungan = n.id_gabungan + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_supplier = '$startDate' + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + + } + $querysupp = "select nama_supplier from supplier where kd_supplier = '$startDate' "; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tahun,$bln,$strip,$kdasli,$nofaktur,$kdbrg,$nmbrg,$nomor,$akhir,$pokok,$hp,$jual,$hj); + $ttJumlah = array(); + $ttJumlah['jml'] = 0; + $ttJumlah['hp'] = 0; + + print("
"); + print("

Laporan Barang Minus Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."

"); + if($stmtsupp = mysqli_prepare($conn,$querysupp)){ + mysqli_stmt_execute($stmtsupp); + mysqli_stmt_store_result($stmtsupp); + $ceksupp = mysqli_stmt_num_rows($stmtsupp); + if($ceksupp > 0){ + mysqli_stmt_bind_result($stmtsupp,$nama); + while(mysqli_stmt_fetch($stmtsupp)){ + print("Supplier : $nama


"); + } + } + } + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['jml'] += $akhir; + $ttJumlah['hp'] += $hp; + print(""); + } + + print("
TahunBulanLini Prod.Kode AsliNo.FakturKode BarangNama BarangNomor Brg.Stok AkhirHPHJTot.HPTot.HJ
$tahun$bln$strip$kdasli.$nofaktur$kdbrg$nmbrg$nomor$akhir".number_format($pokok,0,',','.')."".number_format($jual,0,',','.')."".number_format($hp,0,',','.')."".number_format($hj,0,',','.')."

"); + print("
"); + + print(""); + print(""); + + print("
Total Jumlah Barang : ".number_format($ttJumlah['jml'],0,',','.')."
Total Persediaan : ".number_format($ttJumlah['hp'],0,',','.')."
"); + }else{ + echo ""; + } + } + + + IF ($startDate != '' && $endDate != ''){ + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ, m.status + FROM barang b,no_barang n, d_pembelian d, m_pembelian m + WHERE n.stok > 0 + and b.id_gabungan = n.id_gabungan + and m.no_faktur = d.no_faktur + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_supplier = '$startDate' + and b.kode_strip = '$endDate' + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + }elseif ($startDate == '' && $endDate != ''){ + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ, m.status + FROM barang b,no_barang n, d_pembelian d, m_pembelian m + WHERE n.stok > 0 + and b.id_gabungan = n.id_gabungan + and m.no_faktur = d.no_faktur + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_strip = '$endDate' + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + }else { + $query = "SELECT b.tahun,b.bulan,b.kode_strip,d.kode_asli,d.no_faktur,b.kode_barang,b.nama_barang,n.nomor,n.stok stokAKH, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') hp, + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(n.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0') * n.stok + totalHP,n.harga_jual hj,n.stok*n.harga_jual totalHJ, m.status + FROM barang b,no_barang n, d_pembelian d, m_pembelian m + WHERE n.stok > 0 + and b.id_gabungan = n.id_gabungan + and m.no_faktur = d.no_faktur + and (b.kode_barang = d.kode_barang and d.nomor = n.nomor) + and left(d.no_faktur,4) <> 'RVB-' + and b.kode_supplier = '$startDate' + ORDER BY b.tahun,b.bulan,b.kode_strip,b.kode_barang,n.nomor"; + + } + $querysupp = "select nama_supplier from supplier where kd_supplier = '$startDate' "; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tahun,$bln,$strip,$kdasli,$nofaktur,$kdbrg,$nmbrg,$nomor,$akhir,$pokok,$hp,$jual,$hj,$status); + $ttJumlah = array(); + $ttJumlah['jml'] = 0; + $ttJumlah['hp'] = 0; + + print("
"); + print("

Laporan Persediaan Barang Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."

"); + if($stmtsupp = mysqli_prepare($conn,$querysupp)){ + mysqli_stmt_execute($stmtsupp); + mysqli_stmt_store_result($stmtsupp); + $ceksupp = mysqli_stmt_num_rows($stmtsupp); + if($ceksupp > 0){ + mysqli_stmt_bind_result($stmtsupp,$nama); + while(mysqli_stmt_fetch($stmtsupp)){ + print("Supplier : $nama


"); + } + } + } + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['jml'] += $akhir; + $ttJumlah['hp'] += $hp; + print(" + + + "); + } + + print("
TahunBulanLini Prod.Kode AsliNo.FakturKode BarangNama BarangNomor Brg.Stok AkhirHPHJTot.HPTot.HJStatus Brg
$tahun$bln$strip$kdasli.$nofaktur$kdbrg$nmbrg$nomor$akhir".number_format($pokok,0,',','.')."".number_format($jual,0,',','.')."".number_format($hp,0,',','.')."".number_format($hj,0,',','.')."$status

"); + print("
"); + + print(""); + print(""); + + print("
Total Jumlah Barang : ".number_format($ttJumlah['jml'],0,',','.')."
Total Persediaan : ".number_format($ttJumlah['hp'],0,',','.')."
"); + }else{ + echo "Data tidak ada!"; + } + } + } +?> diff --git a/old-source/barcoding/menu.php b/old-source/barcoding/menu.php new file mode 100644 index 0000000..e19fc00 --- /dev/null +++ b/old-source/barcoding/menu.php @@ -0,0 +1,130 @@ + + + + + +
+ +
diff --git a/old-source/bayar.php b/old-source/bayar.php new file mode 100644 index 0000000..2b5ed18 --- /dev/null +++ b/old-source/bayar.php @@ -0,0 +1,120 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Pembayaran Per Supplier +
+ + + + +
+
+
+ + + +
Range Tanggal: s/d
Kode Supplier: + +
+
+
+
+
+
+
+ +
+
Cari Supplier
+
+ +
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + +
+ + \ No newline at end of file diff --git a/old-source/bon/ajaxpelanggan.php b/old-source/bon/ajaxpelanggan.php new file mode 100644 index 0000000..8596e1c --- /dev/null +++ b/old-source/bon/ajaxpelanggan.php @@ -0,0 +1,266 @@ + +prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function simpan($id_pel, $alias, $stsmember, $ktp, $nama, $alamat, $wilayah, $tp_lahir, $tg_lahir, $jen_kel, $agama, $kerja, $statusnikah, $telp, $hp, $email, $upline, $batasbon, + $nilaibon, $bonistimewa, $komisi, $komisiambil, $statuspel, $tglentry, $operasi) +{ + require_once '../db_login.inc.php'; + $harray = array(); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if ($operasi === "simpan") + { + if($nama != "" && $alamat != ""){ + $stmt = $mysqli->prepare("INSERT INTO pelanggan(kd_customer, ktp, nama, alamat, wilayah, tempat_lahir, tgl_lahir, jns_kelamin, agama, pekerjaan, + status_nikah, telp, ponsel, email, upline, bts_bon, nilai_bon, bts_bon_istimewa, nilai_komisi, komisi_diambil, tgl_entry, jenis_customer) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); + $stmt->bind_param("sssssssssssssssiiiiiss", $id_pel, $ktp, $nama, $alamat, $wilayah, $tp_lahir, $tg_lahir, $jen_kel, $agama, $kerja, $statusnikah, $telp, + $hp, $email, $upline, $batasbon, $nilaibon, $bonistimewa, $komisi, $komisiambil, $tglentry, $statuspel); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $harray[0] = 1; + $stmt->close(); + } else { + $harray[0] = 0; + } + }else{ + $harray[0] = 2; + } + } elseif ($operasi === "update") { + $stmt = $mysqli->prepare("UPDATE pelanggan SET ktp=?, nama=?, alamat=?, wilayah=?, tempat_lahir=?, tgl_lahir=?, jns_kelamin=?, agama=?, pekerjaan=?, + status_nikah=?, telp=?, ponsel=?, email=?, upline=?, bts_bon=?, nilai_bon=?, bts_bon_istimewa=?, nilai_komisi=?, komisi_diambil=?, + jenis_customer=? WHERE kd_customer=?"); + $stmt->bind_param("ssssssssssssssiiiiiss", $ktp, $nama, $alamat, $wilayah, $tp_lahir, $tg_lahir, $jen_kel, $agama, $kerja, $statusnikah, $telp, $hp, + $email, $upline, $batasbon, $nilaibon, $bonistimewa, $komisi, $komisiambil, $statuspel, $id_pel); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $harray[0] = 1; + $stmt->close(); + } else + { + $harray[0] = 0; + } + } + $mysqli->close(); + echo json_encode($harray); +} + +function cek_pelanggan($id_pelanggan) +{ + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT COUNT(*) FROM pelanggan WHERE kd_customer = '{$id_pelanggan}'")->fetch_array(); + if ($data[0] > 0) + { + return true; + } else + { + return false; + } +} + +function cari_pelanggan($nama) { + if($nama != "") { + $harray = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT kd_customer, nama, alamat, nilai_bon, bts_bon FROM pelanggan WHERE nama LIKE '%".$nama."%'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_customer' => $a['kd_customer'], + 'nama' => $a['nama'], + 'alamat' => $a['alamat'], + 'nilai_bon' => number_format($a['nilai_bon'],0,',','.'), + 'bts_bon' => number_format($a['bts_bon'],0,',','.') + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function cari_upline($nama) { + if($nama != "") { + $harray = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT kd_customer, nama, alamat, nilai_bon, bts_bon FROM pelanggan WHERE nama LIKE '%".$nama."%' AND upline = '#'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_customer' => $a['kd_customer'], + 'nama' => $a['nama'], + 'alamat' => $a['alamat'], + 'nilai_bon' => number_format($a['nilai_bon'],0,',','.'), + 'bts_bon' => number_format($a['bts_bon'],0,',','.') + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function ambil_pelanggan($id_pelanggan) { + if ($id_pelanggan != "") { + $array_data = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM pelanggan WHERE kd_customer = '".$id_pelanggan."'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $tgl_lahir = ''; + + if($a['tgl_lahir'] != "") { + $tgl_lahir = substr($a['tgl_lahir'],8,2)."-".substr($a['tgl_lahir'],5,2)."-".substr($a['tgl_lahir'],0,4); + } else { + $tgl_lahir = $a['tgl_lahir']; + } + + $array_data[$idx] = array( + 'kd_customer' => $a['kd_customer'], + 'alias' => $a['alias'], + 'member' => $a['member'], + 'ktp' => $a['ktp'], + 'nama' => $a['nama'], + 'alamat' => $a['alamat'], + 'kd_lokasi' => $a['kd_lokasi'], + 'wilayah' => $a['wilayah'], + 'tempat_lahir' => $a['tempat_lahir'], + 'tgl_lahir' => $tgl_lahir, + 'jns_kelamin' => $a['jns_kelamin'], + 'agama' => $a['agama'], + 'kd_lokasi' => $a['kd_lokasi'], + 'pekerjaan' => $a['pekerjaan'], + 'status_nikah' => $a['status_nikah'], + 'telp' => $a['telp'], + 'ponsel' => $a['ponsel'], + 'email' => $a['email'], + 'status' => $a['status'], + 'upline' => $a['upline'], + 'bts_bon' => $a['bts_bon'], + 'nilai_bon' => $a['nilai_bon'], + 'bts_bon_istimewa' => $a['bts_bon_istimewa'], + 'nilai_komisi' => $a['nilai_komisi'], + 'komisi_diambil' => $a['komisi_diambil'], + 'jenis_customer' => $a['jenis_customer'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($array_data); + } +} + +function ambil_kode() { + $array_data = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT kd_customer FROM pelanggan ORDER BY kd_customer DESC limit 1"); + if($data->num_rows > 0) { + $a = $data->fetch_array(MYSQLI_NUM); + //$kode_awal = substr($a[0],2,6); + $kode_awal = intval(substr($a[0],2,6)); + $kode_awal++; + $strUrut = strlen($kode_awal); + for($i=1;$i<=(6-$strUrut);$i++){ + $kode_awal = "0" . $kode_awal; + } + + //$kode = $kode_awal + 1; + $kode = 'A8'.$kode_awal; + $array_data[0] = $kode; + + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); +} +?> \ No newline at end of file diff --git a/old-source/bon/ak4.php b/old-source/bon/ak4.php new file mode 100644 index 0000000..8dfd39a --- /dev/null +++ b/old-source/bon/ak4.php @@ -0,0 +1,74 @@ + + + + + Amigo Group :: Pengadaan Barang + + + + + + + + + + + + + +
+
+ +
+
+
Rekap Bon dan Titipan (AK.4)
+
+
+
+ + + +
Range Tanggal: s/d
+
+
+
+
+ +
+ + diff --git a/old-source/bon/komisi.php b/old-source/bon/komisi.php new file mode 100644 index 0000000..fdb2135 --- /dev/null +++ b/old-source/bon/komisi.php @@ -0,0 +1,94 @@ + + + + + Amigo Group :: Pengadaan Barang + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
Rekap Komisi Bon
+
+
+
+ + + +
Rentang Tanggal: -
Kode Pelanggan :
+
+
+
+
+
+
+
Cari Pelanggan
+
+
+
+ + + + +
Nama: +
+
+
+ Hasil pencarian +
+
+
+
+ + +
+ + diff --git a/old-source/bon/kontrolbon.php b/old-source/bon/kontrolbon.php new file mode 100644 index 0000000..97dde0a --- /dev/null +++ b/old-source/bon/kontrolbon.php @@ -0,0 +1,64 @@ + + + + + Amigo Group :: Pengadaan Barang + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
Kontrol Bon
+
+
+
+ + +
Batas tampilan data :
+
+
+
+
+
+ + +
+ + diff --git a/old-source/bon/lapak4.php b/old-source/bon/lapak4.php new file mode 100644 index 0000000..47e7432 --- /dev/null +++ b/old-source/bon/lapak4.php @@ -0,0 +1,125 @@ +"; + echo "table.tbl {width:80%;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + if(bukaKoneksi()){ + global $conn; + $query = "SELECT tmpX.tgl,tmpBon.totbon,tmpRetur.totretur,tmpTitip.tottitip + FROM(select date(tgl_bon) tgl + FROM m_bon m + WHERE + date(tgl_bon) between '$startDate' and '$endDate' + group by tgl)tmpX + LEFT OUTER JOIN + (select date(m.tgl_bon) as tgl,sum(d.jumlah*d.hrg_satuan) as totbon + from d_bon d,m_bon m + where + m.no_bon = d.no_bon + and date(tgl_bon) between '$startDate' and '$endDate' + group by date(tgl_bon))tmpBon + ON tmpX.tgl = tmpBon.tgl + LEFT OUTER JOIN + (select date(m.tgl_nota) as tgl, sum(m.jumlah_total) as totretur + from m_nota_retur m + where m.status_nota = 'B' + and date(m.tgl_nota) BETWEEN '$startDate' and '$endDate' + group by date(m.tgl_nota))tmpRetur + ON tmpX.tgl = tmpRetur.tgl + LEFT OUTER JOIN + (select date(t.tgl_byr) tgl,sum(t.bayar_bon) as tottitip + from bayar_bon t + where date(t.tgl_byr) between '$startDate' and '$endDate' + group by date(t.tgl_byr)) tmpTitip + ON tmpX.tgl = tmpTitip.tgl"; + + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tgl,$totA,$totB,$totC); + $ttJumlah = array(); + $ttJumlah['rpbon'] = 0; + $ttJumlah['rpretur'] = 0; + $ttJumlah['rpnettbon'] = 0; + $ttJumlah['rptitip'] = 0; + $ttJumlah['rpkomisi'] = 0; + $ttJumlah['saldo_akh'] = 0; + $ttJumlah['saldo_awalbln'] = 559659149; + $ttJumlah['saldo_awalthn'] = 601788749; + $ttJumlah['saldo_rata2'] = 0; + $ttJumlah['akum_titiplalu'] = 1122281800; + $bulan = substr($_POST['endDate'],3,2); + $ttJumlah['akum_titip'] = 0; + $ttJumlah['rata2_titip'] = 0; + $ttJumlah['usia_piutang'] = 0; + + print("
"); + print("

Rekap AK.4



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."


"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['rpbon'] += $totA; + $ttJumlah['rpretur'] += $totB; + $ttJumlah['rpnettbon'] += $totA-$totB; + $ttJumlah['rptitip'] += $totC; + print(" + + "); + } + print(" + + + "); + print("
TanggalBONRETUR BONNETTO BONTITIPKOMISI
".encTgl($tgl)."".number_format($totA,0,',','.')."".number_format($totB,0,',','.')."".number_format($totA-$totB,0,',','.')."".number_format($totC,0,',','.')."
T O T A L".number_format($ttJumlah['rpbon'],0,',','.')."".number_format($ttJumlah['rpretur'],0,',','.')."".number_format($ttJumlah['rpnettbon'],0,',','.')."".number_format($ttJumlah['rptitip'],0,',','.')."".number_format(0,0,',','.')."

"); + + $ttJumlah['saldo_akh'] = $ttJumlah['saldo_awalbln'] + $ttJumlah['rpnettbon'] - $ttJumlah['rptitip']; + $ttJumlah['saldo_rata2'] = ($ttJumlah['saldo_akh'] + $ttJumlah['saldo_awalthn']) / 2; + $ttJumlah['akum_titip'] = $ttJumlah['akum_titiplalu'] + $ttJumlah['rptitip']; + $ttJumlah['rata2_titip'] = $ttJumlah['akum_titip']/$bulan; + $ttJumlah['usia_piutang'] = $ttJumlah['saldo_rata2'] / $ttJumlah['rata2_titip']; + + print("
"); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print(""); + print("
SALDO AWAL BULAN : ".number_format($ttJumlah['saldo_awalbln'],0,',','.')."
Nett BON : ".number_format($ttJumlah['rpnettbon'],0,',','.')."
TITIP : ".number_format($ttJumlah['rptitip'],0,',','.')."
SALDO AKHIR : ".number_format($ttJumlah['saldo_akh'],0,',','.')."

SALDO AWAL TH : ".number_format($ttJumlah['saldo_awalthn'],0,',','.')."
SALDO RATA-RATA : ".number_format($ttJumlah['saldo_rata2'],0,',','.')."
AKUMULASI TITIP : ".number_format($ttJumlah['akum_titip'],0,',','.')."
RATA2 TITIP : ".number_format($ttJumlah['rata2_titip'],0,',','.')."
USIA PIUTANG : ".number_format($ttJumlah['usia_piutang'],2,',','.')."

KOMISI BLN INI : ".number_format(0,0,',','.')."
AKUMULASI KOMISI : ".number_format(0,0,',','.')."
"); + }else{ + echo "Belum ada data transaksi untuk tanggal tersebut!"; + } + } + } +?> diff --git a/old-source/bon/lapbonperiode.php b/old-source/bon/lapbonperiode.php new file mode 100644 index 0000000..192f582 --- /dev/null +++ b/old-source/bon/lapbonperiode.php @@ -0,0 +1,98 @@ +"; + echo "div#divprint{width:900px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:50px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + +$startDate = decTgl($_POST['startDate']); +$endDate = decTgl($_POST['endDate']); + + if(bukaKoneksi()){ + global $conn; + $query = "select p.kd_customer,p.nama,p.alamat,p.upline from pelanggan p where p.upline = '#'"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdcust,$nama,$alamat,$upline); + $ttJumlah = array(); + + print("
"); + print("

Laporan Rekap Saldo Bon Per Periode



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("Periode Bon Tanggal : ".encTgl($startDate)." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."

"); + print(""); + print(""); + while(mysqli_stmt_fetch($stmt)){ + $query2 = "select sum(m.jumlah_total) + from pelanggan p2 force index (primary,upline), m_bon m force index (kd_plg) + where p2.kd_customer = m.kode_plg and + (p2.upline = '$kdcust' or p2.kd_customer = '$kdcust') + and date(m.tgl_bon) BETWEEN '$startDate' and '$endDate' + group by p2.kd_customer"; + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$total); + $ttJumlah['totalbon'] = 0; + while(mysqli_stmt_fetch($stmt2)){ + $ttJumlah['totalbon'] += $total; + } + }else{ + $ttJumlah['totalbon'] = 0; + } + } + + $query3 = "select m.jumlah_total,t.bayar_bon + from pelanggan p force index (primary,upline),bayar_bon t left join m_bon m on (t.no_bon = m.no_bon) + where t.kd_plg = p.kd_customer + and (t.kd_plg = '$kdcust' or p.upline = '$kdcust') + and date(t.tgl_byr) between '$startDate' and '$endDate'"; + + if($stmt3 = mysqli_prepare($conn,$query3)){ + mysqli_stmt_execute($stmt3); + mysqli_stmt_store_result($stmt3); + $cek3 = mysqli_stmt_num_rows($stmt3); + if($cek3 > 0){ + mysqli_stmt_bind_result($stmt3,$totNota,$titip); + $ttJumlah['titip'] = 0; + while(mysqli_stmt_fetch($stmt3)){ + $ttJumlah['titip'] += $titip; + } + }else{ + $ttJumlah['titip'] = 0; + } + } + + if ($ttJumlah['totalbon'] != 0){ + print(""); + } + } + print("
Kode PlgNamaAlamatUplineTotal BonTotal Titip
$kdcust$nama$alamat$upline".number_format($ttJumlah['totalbon'], 0, ",", ".")."".number_format($ttJumlah['titip'], 0, ",", ".")."

"); + print("
"); + }else{ + echo "Data tidak ditemukan!"; + } + } + } +?> + diff --git a/old-source/bon/lapkomisi.php b/old-source/bon/lapkomisi.php new file mode 100644 index 0000000..4672a1a --- /dev/null +++ b/old-source/bon/lapkomisi.php @@ -0,0 +1,96 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $kodeplg = $_POST['kdplg']; + + if(bukaKoneksi()){ + global $conn; + IF (strlen($startDate) > 2 && strlen($endDate) > 2 && $kodeplg !=''){ + $query = "select k.tgl_ambil,k.kd_plg,p.nama,k.jumlah,k.kd_kasir + from pelanggan p,komisi k + where k.kd_plg = p.kd_customer + and date(k.tgl_ambil) between '$startDate' and '$endDate' + and k.kd_plg = '$kodeplg' + order by k.tgl_ambil,k.kd_plg"; + }elseif ($startDate != '' && $endDate != '' && $kodeplg =='' ){ + $query = "select k.tgl_ambil,k.kd_plg,p.nama,k.jumlah,k.kd_kasir + from pelanggan p,komisi k + where k.kd_plg = p.kd_customer + and date(k.tgl_ambil) between '$startDate' and '$endDate' + order by k.tgl_ambil,k.kd_plg"; + }elseif (strlen($startDate) <= 2 && strlen($endDate) <= 2 && $kodeplg !=''){ + $query = "select k.tgl_ambil,k.kd_plg,p.nama,k.jumlah,k.kd_kasir + from pelanggan p,komisi k + where k.kd_plg = p.kd_customer + and k.kd_plg = '$kodeplg' + order by k.tgl_ambil,k.kd_plg"; + } + $querynama = "select nama from pelanggan where kd_customer = '$kodeplg'"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek >= 0){ + mysqli_stmt_bind_result($stmt,$tgl,$kdplg,$nama,$juml,$kasir); + $ttJumlah = array(); + + $ttJumlah['hp'] = 0; + print("
"); + print("

Laporan Rekap Komisi Bon



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."
"); + if($stmtnama = mysqli_prepare($conn,$querynama)){ + mysqli_stmt_execute($stmtnama); + mysqli_stmt_store_result($stmtnama); + $ceknama = mysqli_stmt_num_rows($stmtnama); + if($ceknama > 0){ + mysqli_stmt_bind_result($stmtnama,$nama); + + while(mysqli_stmt_fetch($stmtnama)){ + print("Nama Pelanggan : ".$nama."
"); + } + } + } + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['rp'] += $juml; + print(""); + } + + print("
Tanggal AmbilKode PlgNamaKomisi yg diambilKasir
$tgl$kdplg$nama".number_format($juml, 0, ",", ".")."$kasir

"); + print("
"); + + print(""); + print("
Total Komisi Bon : ".number_format($ttJumlah['rp'],0,',','.')."
"); + }else{ + echo "Data tidak ditemukan!"; + } + } + } +?> + diff --git a/old-source/bon/lapkontrolbon.php b/old-source/bon/lapkontrolbon.php new file mode 100644 index 0000000..dcb4b70 --- /dev/null +++ b/old-source/bon/lapkontrolbon.php @@ -0,0 +1,65 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $limit = $_POST['limit']; + + if(bukaKoneksi()){ + global $conn; + $query = "select p.upline,p2.nama nama_upline,m.kode_plg,p.nama,m.tgl_bon,m.no_bon,m.jumlah_total,m.kasir + from m_bon m inner join pelanggan p on m.kode_plg = p.kd_customer + left join pelanggan p2 on p.upline = p2.kd_customer + where m.status = 'B' + order by m.tgl_bon,p.upline,m.kode_plg + limit ".$limit.""; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek >= 0){ + mysqli_stmt_bind_result($stmt,$upline,$nmupline,$kdplg,$nama,$tgl,$nobon,$juml,$kasir); + + $ttJumlah = array(); + $ttJumlah['hp'] = 0; + + print("
"); + print("

Laporan Rekap Kontrol Bon



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."
"); + + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['rp'] += $juml; + print(""); + } + + print("
Kd.PngJwbNama PngJwbKode PlgNamaTgl NotaNo.NotaJumlahKasir
$upline$nmupline$kdplg$nama$tgl$nobon".number_format($juml, 0, ",", ".")."$kasir

"); + print("
"); + }else{ + echo "Data tidak ditemukan!"; + } + } + } +?> + diff --git a/old-source/bon/laprekapbon.php b/old-source/bon/laprekapbon.php new file mode 100644 index 0000000..4aa15cb --- /dev/null +++ b/old-source/bon/laprekapbon.php @@ -0,0 +1,108 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $kodeplg = $_POST['kodepelanggan']; + + if(bukaKoneksi()){ + global $conn; + IF (strlen($startDate) > 2 && strlen($endDate) > 2 && $kodeplg !=''){ + $query = "select m.tgl_bon,m.kode_plg,p.nama,p.upline,m.no_bon,sum(d.jumlah*d.hrg_satuan),m.kasir + from d_bon d,m_bon m,pelanggan p + where + m.kode_plg = p.kd_customer + and m.no_bon = d.no_bon + and date(tgl_bon) between '$startDate' and '$endDate' + and (p.kd_customer = '$kodeplg' or p.upline = '$kodeplg') + group by m.no_bon + order by m.tgl_bon,p.kd_customer"; + }elseif ($startDate != "" && $endDate != "" && $kodeplg =='' ){ + $query = "select m.tgl_bon,m.kode_plg,p.nama,p.upline,m.no_bon,sum(d.jumlah*d.hrg_satuan),m.kasir + from d_bon d,m_bon m,pelanggan p + where + m.kode_plg = p.kd_customer + and m.no_bon = d.no_bon + and date(tgl_bon) between '$startDate' and '$endDate' + group by m.no_bon + order by m.tgl_bon,p.kd_customer"; + }elseif (strlen($startDate) <= 2 && strlen($endDate) <= 2 && $kodeplg !=''){ + $query = "select m.tgl_bon,m.kode_plg,p.nama,p.upline,m.no_bon,sum(d.jumlah*d.hrg_satuan),m.kasir + from d_bon d,m_bon m,pelanggan p + where + m.kode_plg = p.kd_customer + and m.no_bon = d.no_bon + and (p.kd_customer = '$kodeplg' or p.upline = '$kodeplg') + group by m.no_bon + order by m.tgl_bon,p.kd_customer"; + } + + + $querynama = "select nama from pelanggan where kd_customer = '$kodeplg'"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tgl,$kdplg,$nama,$upline,$nomor,$tot,$kasir); + $ttJumlah = array(); + + $ttJumlah['hp'] = 0; + + print("
"); + print("

Laporan Rekap Bon



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."
"); + if($stmtnama = mysqli_prepare($conn,$querynama)){ + mysqli_stmt_execute($stmtnama); + mysqli_stmt_store_result($stmtnama); + $ceknama = mysqli_stmt_num_rows($stmtnama); + if($ceknama > 0){ + mysqli_stmt_bind_result($stmtnama,$nama); + + while(mysqli_stmt_fetch($stmtnama)){ + print("Nama Pelanggan : ".$nama."
"); + } + } + } + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['hp'] += $tot; + print(""); + } + + print("
Tanggal BonKode PlgNamaPenanggung JawabNomor Nota BonTotal BelanjaKasir
".encTgl($tgl)."$kdplg$nama$upline$nomor".number_format($tot, 0, ",", ".")."$kasir

"); + print("
"); + + print(""); + + print("
Total Bon : ".number_format($ttJumlah['hp'],0,',','.')."
"); + }else{ + echo "Data tidak ditemukan!"; + } + } + } +?> + diff --git a/old-source/bon/laprekappj.php b/old-source/bon/laprekappj.php new file mode 100644 index 0000000..07a2316 --- /dev/null +++ b/old-source/bon/laprekappj.php @@ -0,0 +1,297 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:50px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $kodeplg = $_POST['kodepelanggan']; + + if(bukaKoneksi()){ + global $conn; + IF ($kodeplg !=''){ +// $query = "select m.kode_plg,p2.nama,m.tgl_bon, m.no_bon, m.jumlah_total,m.kasir +// from pelanggan p1, pelanggan p2, m_bon m force index(kd_plg) +// where p2.kd_customer = m.kode_plg and m.status = 'B' +// and ((p1.upline = '$kodeplg'and p1.kd_customer = p2.upline) +// or p2.upline = '$kodeplg' +// or p2.kd_customer = '$kodeplg') +// group by m.tgl_bon, p2.kd_customer,no_bon"; +/*------------query untuk downline lapis 2--------------------*/ +// $queryLunas = "select m.kode_plg,p2.nama,m.tgl_bon, m.no_bon, m.jumlah_total,m.kasir +// from pelanggan p1, pelanggan p2, m_bon m force index(kd_plg) +// where p2.kd_customer = m.kode_plg and m.status = 'L' +// and ((p1.upline = '$kodeplg'and p1.kd_customer = p2.upline) +// or p2.upline = '$kodeplg' +// or p2.kd_customer = '$kodeplg') +// group by m.tgl_bon, p2.kd_customer,no_bon"; + + + // Query NOTA BELUM LUNAS + IF (strlen($startDate) > 2 && strlen($endDate) > 2){ + $query = "select m.kode_plg,p2.nama,m.tgl_bon, m.no_bon, m.jumlah_total,m.kasir,datediff(date(now()),date(m.tgl_bon)) usianota + from pelanggan p2, m_bon m + where p2.kd_customer = m.kode_plg and m.status = 'B' and + (p2.upline = '$kodeplg' + or p2.kd_customer = '$kodeplg') + and date(m.tgl_bon) between '$startDate' and '$endDate' + order by m.tgl_bon, p2.kd_customer,no_bon"; + + $qrypenagihan = "select m.kode_plg,p2.nama,m.tgl_bon, m.no_bon, m.jumlah_total,m.kasir,datediff(date(now()),date(m.tgl_bon)) usianota + from pelanggan p2, m_bon m + where p2.kd_customer = m.kode_plg and m.status = 'B' and + (p2.upline = '$kodeplg' + or p2.kd_customer = '$kodeplg') + and date(m.tgl_bon) between '$startDate' and '$endDate' + order by p2.kd_customer,m.tgl_bon,no_bon"; + + + $query2 = "select nama, alamat from pelanggan where kd_customer = '$kodeplg'"; + + $query3 = "select m.jumlah_total,t.bayar_bon + from pelanggan p,bayar_bon t left join m_bon m on (t.no_bon = m.no_bon) + where t.kd_plg = p.kd_customer + and (t.kd_plg = '$kodeplg' or p.upline = '$kodeplg') + order by t.tgl_byr,t.no_bon"; + + $query4 = "select distinct p2.nilai_bon, p2.kd_customer + from pelanggan p2, m_bon m + where p2.kd_customer = m.kode_plg and + (p2.upline = '$kodeplg' or p2.kd_customer = '$kodeplg')"; + + $query5 = "select p2.kd_customer,p2.nilai_bon,p2.upline,m.kode_plg,m.tgl_bon, m.no_bon, m.jumlah_total + from pelanggan p2, m_bon m where p2.kd_customer = m.kode_plg and m.status != 'L' and + (p2.upline = '$kodeplg' or p2.kd_customer = '$kodeplg') + order by m.tgl_bon, p2.kd_customer,no_bon + ')"; + + + }elseif (strlen($startDate) <= 2 && strlen($endDate) <= 2){ + echo "tanggal belum diisi"; + } + }else{ + echo "kode pelanggan belum diisi
"; + } + +//untuk penagihan + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$nama,$alamat); + print("
"); + print("

Rekap Untuk Penanggungjawab Bon



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."
"); + print("Kode : ".$kodeplg."
"); + while(mysqli_stmt_fetch($stmt2)){ + print("Nama : ".$nama."
"); + print("Alamat : ".$alamat."

"); + + } + } + } + + + + if($stmtPenagihan = mysqli_prepare($conn,$qrypenagihan)){ + mysqli_stmt_execute($stmtPenagihan); + mysqli_stmt_store_result($stmtPenagihan); + $cekPenagihan = mysqli_stmt_num_rows($stmtPenagihan); + if($cekPenagihan > 0){ + mysqli_stmt_bind_result($stmtPenagihan,$kdplg,$nama,$tgl,$nomor,$hp,$kasir,$usianota); + $kode = 0; + $tt_tempjumlah = 0; + print("

Rincian Transaksi Belum Lunas


"); + print(""); + print(""); + while(mysqli_stmt_fetch($stmtPenagihan)){ + $tt_tempjumlah += $hp; + $kd[$kode]['kd'] = $kdplg; + $nm[$kode]['kd'] = $nama; + $tanggal[$kode]['kd'] = $tgl; + $no[$kode]['kd'] = $nomor; + $hape[$kode]['kd'] = $hp; + $ksr[$kode]['kd'] = $kasir; + $usia[$kode]['kd'] = $usianota; + $kode++; + } + for($i=0;$i<$kode;$i++){ + if($kd[$i-1]['kd']==$kd[$i]['kd']){ + print(""); + }else{ + if($tempjumlah == 0){ + print(""); + }else{ + print(""); + print(""); + } + $tempjumlah = 0; + } + $tempjumlah += $hape[$i]['kd']; + } + print(""); + + print("
Kode PlgNamaTgl BonNomor Nota BonTotal BelanjaKasirUsiaNota(hari)
".$kd[$i]['kd']."".$nm[$i]['kd']."".$tanggal[$i]['kd']."".$no[$i]['kd']."".number_format($hape[$i]['kd'], 0, ",", ".")."".$ksr[$i]['kd']."".$usia[$i]['kd']."
".$kd[$i]['kd']."".$nm[$i]['kd']."".$tanggal[$i]['kd']."".$no[$i]['kd']."".number_format($hape[$i]['kd'], 0, ",", ".")."".$ksr[$i]['kd']."".$usia[$i]['kd']."
Sub Total".number_format($tempjumlah, 0, ",", ".")."
".$kd[$i]['kd']."".$nm[$i]['kd']."".$tanggal[$i]['kd']."".$no[$i]['kd']."".number_format($hape[$i]['kd'], 0, ",", ".")."".$ksr[$i]['kd']."".$usia[$i]['kd']."
Sub Total".number_format($tempjumlah, 0, ",", ".")."

"); + print("
"); + print(""); + + + print("
Total Bon Belum Lunas : ".number_format($tt_tempjumlah,0,',','.')."
"); + }else{ + echo "Data tidak ditemukan"; + } + } + +//end of untuk penagihan + + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$nama,$alamat); + print("
"); + print("

Laporan Rekap Penanggungjawab Bon



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."
"); + print("Kode : ".$kodeplg."
"); + while(mysqli_stmt_fetch($stmt2)){ + print("Nama : ".$nama."
"); + print("Alamat : ".$alamat."


"); + + } + } + } + + // Query NOTA LUNAS + IF (strlen($startDate) > 2 && strlen($endDate) > 2){ + $queryLunas = "select m.kode_plg,p2.nama,m.tgl_bon, m.no_bon, m.jumlah_total,m.kasir,datediff(date(byr.tgl_byr ),date(m.tgl_bon)) usianota + from pelanggan p2, m_bon m, bayar_bon byr + where p2.kd_customer = m.kode_plg and m.status = 'L' and + (p2.upline = '$kodeplg' + or p2.kd_customer = '$kodeplg') + and m.tgl_bon between '$startDate' and '$endDate' + and m.no_bon = byr.no_bon + order by m.tgl_bon, p2.kd_customer,no_bon"; + }elseif (strlen($startDate) <= 2 && strlen($endDate) <= 2){ + $queryLunas = "select m.kode_plg,p2.nama,m.tgl_bon, m.no_bon, m.jumlah_total,m.kasir,datediff(date(byr.tgl_byr ),date(m.tgl_bon)) usianota + from pelanggan p2, m_bon m, bayar_bon byr + where p2.kd_customer = m.kode_plg and m.status = 'L' and + (p2.upline = '$kodeplg' + or p2.kd_customer = '$kodeplg') + and m.no_bon = byr.no_bon + order by m.tgl_bon, p2.kd_customer,no_bon"; + } + if($stmtLunas = mysqli_prepare($conn,$queryLunas)){ + mysqli_stmt_execute($stmtLunas); + mysqli_stmt_store_result($stmtLunas); + $cekLunas = mysqli_stmt_num_rows($stmtLunas); + if($cekLunas > 0){ + mysqli_stmt_bind_result($stmtLunas,$kdplgL,$namaL,$tglL,$nomorL,$hpL,$kasirL,$usiaL); + + print("

Rincian Transaksi Lunas


"); + print(""); + print(""); + while(mysqli_stmt_fetch($stmtLunas)){ + $ttJumlah['hpL'] += $hpL; + print(""); + } + print("
Kode PlgNamaTgl BonNomor Nota BonTotal BelanjaKasirUsiaPelunasan(hari)
$kdplgL$namaL$tglL$nomorL".number_format($hpL, 0, ",", ".")."$kasirL$usiaL

"); + print("
"); + print(""); + print("
Total Bon Sudah Lunas : ".number_format($ttJumlah['hpL'],0,',','.')."
"); + }else{ + echo "Tidak ada nota lunas
"; + } + + } + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdplg,$nama,$tgl,$nomor,$hp,$kasir,$usianota); + $ttJumlah = array(); + + $ttJumlah['hp'] = 0; + + print("

Rincian Transaksi Belum Lunas


"); + print(""); + print(""); + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['hp'] += $hp; + print(""); + } + print("
Kode PlgNamaTgl BonNomor Nota BonTotal BelanjaKasirUsiaNota(hari)
$kdplg$nama$tgl$nomor".number_format($hp, 0, ",", ".")."$kasir$usianota

"); + print("
"); + print(""); + + if($stmt3 = mysqli_prepare($conn,$query3)){ + mysqli_stmt_execute($stmt3); + mysqli_stmt_store_result($stmt3); + $cek3 = mysqli_stmt_num_rows($stmt3); + if($cek3 > 0){ + mysqli_stmt_bind_result($stmt3,$totNota,$titip); + while(mysqli_stmt_fetch($stmt3)){ + $ttJumlah['titip'] += $titip; + $ttJumlah['nota'] += $totNota; + $saldotitip = $ttJumlah['titip'] - $ttJumlah['nota']; + } + print(""); + } + } + if($stmt5 = mysqli_prepare($conn,$query5)){ + mysqli_stmt_execute($stmt5); + mysqli_stmt_store_result($stmt5); + $cek5 = mysqli_stmt_num_rows($stmt5); + if($cek5 > 0){ + mysqli_stmt_bind_result($stmt5,$kd_customer,$nilai_bon,$upline,$kode_plg,$tgl_bon,$no_bon,$jumlah_total); + while(mysqli_stmt_fetch($stmt5)){ + $ttJumlah['jumlah_total'] += $jumlah_total; + } + } + } + if($stmt4 = mysqli_prepare($conn,$query4)){ + mysqli_stmt_execute($stmt4); + mysqli_stmt_store_result($stmt4); + $cek4 = mysqli_stmt_num_rows($stmt4); + if($cek4 > 0){ + mysqli_stmt_bind_result($stmt4,$nilai_bon,$kd_cust); + while(mysqli_stmt_fetch($stmt4)){ + $ttJumlah['nilai_bon'] += $nilai_bon; + } + print(""); + } + } + print(""); + print("
Total Bon Belum Lunas : ".number_format($ttJumlah['hp'],0,',','.')."
Saldo Titip : ".number_format($saldotitip,0,',','.')."
Saldo Titip (versi prg kasir) : ".number_format($ttJumlah['hp']-$ttJumlah['nilai_bon'],0,',','.')."
Total Net Bon : ".number_format($ttJumlah['hp']-$saldotitip,0,',','.')."
"); + }else{ + echo "Tidak ada nota belum lunas"; + } + } + + } +?> + diff --git a/old-source/bon/lapreturbon.php b/old-source/bon/lapreturbon.php new file mode 100644 index 0000000..1323063 --- /dev/null +++ b/old-source/bon/lapreturbon.php @@ -0,0 +1,103 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $kodeplg = $_POST['kodepelanggan']; + + if(bukaKoneksi()){ + global $conn; + IF (strlen($startDate) > 2 && strlen($endDate) > 2 && $kodeplg !=''){ + $query = "select distinct m.tgl_nota, m.no_nota,d.no_nota_tunai, m.kd_customer,p.nama namaPlg, m.jumlah_total, k.nama kasir + from m_nota_retur m, d_nota_retur d, pelanggan p,karyawan k + where m.status_nota = 'B' + and m.no_nota = d.no_nota + and m.kasir = k.nik + and m.kd_customer = p.kd_customer + and date(m.tgl_nota) BETWEEN '$startDate' and '$endDate' + and (p.kd_customer = '$kodeplg' or p.upline = '$kodeplg')"; + }elseif ($startDate != '' && $endDate != '' && $kodeplg =='' ){ + $query = "select distinct m.tgl_nota, m.no_nota,d.no_nota_tunai, m.kd_customer,p.nama namaPlg, m.jumlah_total, k.nama kasir + from m_nota_retur m, d_nota_retur d, pelanggan p,karyawan k + where m.status_nota = 'B' + and m.no_nota = d.no_nota + and m.kasir = k.nik + and m.kd_customer = p.kd_customer + and date(m.tgl_nota) BETWEEN '$startDate' and '$endDate'"; + }elseif (strlen($startDate) <= 2 && strlen($endDate) <= 2 && $kodeplg !=''){ + $query = "select distinct m.tgl_nota, m.no_nota,d.no_nota_tunai, m.kd_customer,p.nama namaPlg, m.jumlah_total, k.nama kasir + from m_nota_retur m, d_nota_retur d, pelanggan p,karyawan k + where m.status_nota = 'B' + and m.no_nota = d.no_nota + and m.kasir = k.nik + and m.kd_customer = p.kd_customer + and (p.kd_customer = '$kodeplg' or p.upline = '$kodeplg')"; + } + $querynama = "select nama from pelanggan where kd_customer = '$kodeplg'"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tgl,$no,$nobon,$kdplg,$nmplg,$total,$kasir); + $ttJumlah = array(); + + $ttJumlah['hp'] = 0; + + print("
"); + print("

Laporan Rekap Retur Bon



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."
"); + if($stmtnama = mysqli_prepare($conn,$querynama)){ + mysqli_stmt_execute($stmtnama); + mysqli_stmt_store_result($stmtnama); + $ceknama = mysqli_stmt_num_rows($stmtnama); + if($ceknama > 0){ + mysqli_stmt_bind_result($stmtnama,$nama); + + while(mysqli_stmt_fetch($stmtnama)){ + print("Nama Pelanggan : ".$nama."
"); + } + } + } + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['hp'] += $total; + print(""); + } + + print("
TanggalNo Nota ReturNo Nota BonKode Plg.Nama Plg.TotalKasir
$tgl$no$nobon$kdplg$nmplg".number_format($total, 0, ",", ".")."$kasir

"); + print("
"); + + print(""); + + print("
Total Retur Bon : ".number_format($ttJumlah['hp'],0,',','.')."
"); + }else{ + echo "Data tidak ditemukan!"; + } + } + } +?> + diff --git a/old-source/bon/laprincikomisi.php b/old-source/bon/laprincikomisi.php new file mode 100644 index 0000000..cf71291 --- /dev/null +++ b/old-source/bon/laprincikomisi.php @@ -0,0 +1,90 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $kodeplg = $_POST['kdplg']; + + if(bukaKoneksi()){ + global $conn; + IF (strlen($startDate) > 2 && strlen($endDate) > 2 && $kodeplg !=''){ + $query = "select t.kd_plg,p.nama, + case when datediff(t.tgl_byr,date(m.tgl_bon)) <= 46 then '10%' + when datediff(t.tgl_byr,date(m.tgl_bon)) >= 47 and datediff(t.tgl_byr,date(m.tgl_bon)) <= 76 then '7.5%' + when datediff(t.tgl_byr,date(m.tgl_bon)) >= 77 and datediff(t.tgl_byr,date(m.tgl_bon)) <= 107 then '5%' + when datediff(t.tgl_byr,date(m.tgl_bon)) >= 108 then '0%' + end as komisi,sum(t.jumlah_bon) jumlah_bon + from bayar_bon t inner join m_bon m on t.no_bon = m.no_bon inner join pelanggan p on t.kd_plg = p.kd_customer + where t.jumlah_bon <> 0 and date(t.tgl_byr) between '$startDate' and '$endDate' + and t.kd_plg = '$kodeplg' + group by t.kd_plg, komisi"; + }elseif ($startDate != "" && $endDate != "" && $kodeplg =='' ){ + $query = "select t.kd_plg,p.nama, + case when datediff(t.tgl_byr,date(m.tgl_bon)) <= 46 then '10%' + when datediff(t.tgl_byr,date(m.tgl_bon)) >= 47 and datediff(t.tgl_byr,date(m.tgl_bon)) <= 76 then '7.5%' + when datediff(t.tgl_byr,date(m.tgl_bon)) >= 77 and datediff(t.tgl_byr,date(m.tgl_bon)) <= 107 then '5%' + when datediff(t.tgl_byr,date(m.tgl_bon)) >= 108 then '0%' + end as komisi,sum(t.jumlah_bon) jumlah_bon + from bayar_bon t inner join m_bon m on t.no_bon = m.no_bon inner join pelanggan p on t.kd_plg = p.kd_customer + where t.jumlah_bon <> 0 and date(t.tgl_byr) between '$startDate' and '$endDate' + group by t.kd_plg, komisi"; + }elseif (strlen($startDate) <= 2 && strlen($endDate) <= 2 && $kodeplg !=''){ + $query = "select t.kd_plg,p.nama, + case when datediff(t.tgl_byr,date(m.tgl_bon)) <= 46 then '10%' + when datediff(t.tgl_byr,date(m.tgl_bon)) >= 47 and datediff(t.tgl_byr,date(m.tgl_bon)) <= 76 then '7.5%' + when datediff(t.tgl_byr,date(m.tgl_bon)) >= 77 and datediff(t.tgl_byr,date(m.tgl_bon)) <= 107 then '5%' + when datediff(t.tgl_byr,date(m.tgl_bon)) >= 108 then '0%' + end as komisi,sum(t.jumlah_bon) jumlah_bon + from bayar_bon t inner join m_bon m on t.no_bon = m.no_bon inner join pelanggan p on t.kd_plg = p.kd_customer + where t.jumlah_bon <> 0 and t.kd_plg = '$kodeplg' + group by t.kd_plg, komisi"; + } + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek >= 0){ + mysqli_stmt_bind_result($stmt,$kdplg,$nama,$komisi,$juml); + print("
"); + print("

Laporan Rekap Rinci Komisi Bon



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."
"); + + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $tmp = $komisi * $juml / 100; + print(""); + } + + print("
Kode PlgNamaKategori KomisiJumlah BonTotal Komisi
$kdplg$nama$komisi".number_format($juml, 0, ",", ".")."".number_format($tmp, 0, ",", ".")."

"); + print("
"); + }else{ + echo "Data tidak ditemukan!"; + } + } + } +?> + diff --git a/old-source/bon/lapsaldobon.php b/old-source/bon/lapsaldobon.php new file mode 100644 index 0000000..83865b8 --- /dev/null +++ b/old-source/bon/lapsaldobon.php @@ -0,0 +1,142 @@ +"; + echo "div#divprint{width:950px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:800px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:30px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['jtTempo']); + + if(bukaKoneksi()){ + global $conn; + $query = "select p.kd_customer,p.nama,p.alamat,p.upline from pelanggan p where p.upline = '#'"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdcust,$nama,$alamat,$upline); + $ttJumlah = array(); + $ttJumlahTotalBon = 0; + $ttJumlahSaldoTitip = 0; + $ttJumlahNetSaldo = 0; + $ttJumlahBonLimit = 0; + + print("
"); + print("

Laporan Rekap Saldo Bon



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("Jatuh Tempo Tanggal : ".encTgl($startDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."
"); + print(""); + print(""); + while(mysqli_stmt_fetch($stmt)){ + $query2 = "select sum(m.jumlah_total) + from pelanggan p2 force index (primary,upline), m_bon m force index (kd_plg) + where p2.kd_customer = m.kode_plg and m.status = 'B' and + (p2.upline = '$kdcust' + or p2.kd_customer = '$kdcust') + group by p2.kd_customer"; + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$total); + $ttJumlah['totalbon'] = 0; + while(mysqli_stmt_fetch($stmt2)){ + $ttJumlah['totalbon'] += $total; + } + }else{ + $ttJumlah['totalbon'] = 0; + } + } + + $query3 = "select m.jumlah_total,t.bayar_bon + from pelanggan p force index (primary,upline),bayar_bon t left join m_bon m on (t.no_bon = m.no_bon) + where t.kd_plg = p.kd_customer + and (t.kd_plg = '$kdcust' or p.upline = '$kdcust')"; + + if($stmt3 = mysqli_prepare($conn,$query3)){ + mysqli_stmt_execute($stmt3); + mysqli_stmt_store_result($stmt3); + $cek3 = mysqli_stmt_num_rows($stmt3); + if($cek3 > 0){ + mysqli_stmt_bind_result($stmt3,$totNota,$titip); + $ttJumlah['titip'] = 0; + $ttJumlah['nota'] = 0; + while(mysqli_stmt_fetch($stmt3)){ + $ttJumlah['titip'] += $titip; + $ttJumlah['nota'] += $totNota; + $saldotitip = $ttJumlah['titip'] - $ttJumlah['nota']; + } + }else{ + $saldotitip = 0; + } + } + + $query4 = "select sum(m.jumlah_total) + from pelanggan p2 force index (primary,upline), m_bon m force index (kd_plg) + where p2.kd_customer = m.kode_plg and m.status = 'B' and + (p2.upline = '$kdcust' + or p2.kd_customer = '$kdcust') + and date(m.tgl_bon) <= '$startDate' + group by p2.kd_customer"; + if($stmt4 = mysqli_prepare($conn,$query4)){ + mysqli_stmt_execute($stmt4); + mysqli_stmt_store_result($stmt4); + $cek4 = mysqli_stmt_num_rows($stmt4); + if($cek4 > 0){ + mysqli_stmt_bind_result($stmt4,$total4); + $ttJumlah['bonlimit'] = 0; + while(mysqli_stmt_fetch($stmt4)){ + $ttJumlah['bonlimit'] += $total4; + } + }else{ + $ttJumlah['bonlimit'] = 0; + } + } + + $netsaldo = $ttJumlah['totalbon']-$saldotitip; + + if ($netsaldo != 0){ + $urut ++; + print(" + + + + "); + $ttJumlahTotalBon += $ttJumlah['totalbon']; + $ttJumlahSaldoTitip += $saldotitip; + $ttJumlahNetSaldo += $netsaldo; + $ttJumlahBonLimit += $ttJumlah['bonlimit']; + } + + } + print(" + + + + "); + print("
No.Kode PlgNamaAlamatUplineTotal BonTotal TitipSaldo Net BonSaldo Jth Tempo
$urut$kdcust$nama$alamat$upline".number_format($ttJumlah['totalbon'], 0, ",", ".")."".number_format($saldotitip, 0, ",", ".")."".number_format($netsaldo, 0, ",", ".")."".number_format($ttJumlah['bonlimit'], 0, ",", ".")."
".number_format($ttJumlahTotalBon, 0, ",", ".")."".number_format($ttJumlahSaldoTitip, 0, ",", ".")."".number_format($ttJumlahNetSaldo, 0, ",", ".")."".number_format($ttJumlahBonLimit, 0, ",", ".")."

"); + print("
"); + }else{ + echo "Data tidak ditemukan!"; + } + } + } +?> + diff --git a/old-source/bon/laptitipan.php b/old-source/bon/laptitipan.php new file mode 100644 index 0000000..0009e8a --- /dev/null +++ b/old-source/bon/laptitipan.php @@ -0,0 +1,100 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:750px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $kodeplg = $_POST['kodepelanggan']; + + if(bukaKoneksi()){ + global $conn; + IF (strlen($startDate) > 2 && strlen($endDate) > 2 && $kodeplg !=''){ + $query = "select t.tgl_byr,t.kd_plg,p.nama,p.upline,t.no_bon,t.jumlah_bon,t.bayar_bon,t.kd_kasir + from pelanggan p,bayar_bon t + where t.kd_plg = p.kd_customer + and date(t.tgl_byr) between '$startDate' and '$endDate' + and (t.kd_plg = '$kodeplg' or p.upline = '$kodeplg') + order by t.tgl_byr,t.no_bon "; + }elseif ($startDate != '' && $endDate != '' && $kodeplg =='' ){ + $query = "select t.tgl_byr,t.kd_plg,p.nama,p.upline,t.no_bon,t.jumlah_bon,t.bayar_bon,t.kd_kasir + from pelanggan p,bayar_bon t + where t.kd_plg = p.kd_customer + and date(t.tgl_byr) between '$startDate' and '$endDate' + order by t.tgl_byr,t.kd_plg"; + }elseif (strlen($startDate) <= 2 && strlen($endDate) <= 2 && $kodeplg !=''){ + $query = "select t.tgl_byr,t.kd_plg,p.nama,p.upline,t.no_bon,t.jumlah_bon,t.bayar_bon,t.kd_kasir + from pelanggan p,bayar_bon t + where t.kd_plg = p.kd_customer + and (t.kd_plg = '$kodeplg' or p.upline = '$kodeplg') + order by t.tgl_byr,t.no_bon"; + } + $querynama = "select nama from pelanggan where kd_customer = '$kodeplg'"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek >= 0){ + mysqli_stmt_bind_result($stmt,$tahun,$strip,$kdbrg,$nmbrg,$nomor,$totNota,$hp,$kasir); + $ttJumlah = array(); + + $ttJumlah['hp'] = 0; + print("
"); + print("

Laporan Rekap Titipan Bon



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("PERIODE : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y [H:i]')."
"); + if($stmtnama = mysqli_prepare($conn,$querynama)){ + mysqli_stmt_execute($stmtnama); + mysqli_stmt_store_result($stmtnama); + $ceknama = mysqli_stmt_num_rows($stmtnama); + if($ceknama > 0){ + mysqli_stmt_bind_result($stmtnama,$nama); + + while(mysqli_stmt_fetch($stmtnama)){ + print("Nama Pelanggan : ".$nama."
"); + } + } + } + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + $ttJumlah['hp'] += $hp; + $ttJumlah['rp'] += $totNota; + if ($hp != 0) { + print(""); + } + } + + print("
Tanggal TitipKode PlgNamaPenanggung JawabTotal TitipanKasir
".encTgl($tahun)."$strip$kdbrg$nmbrg".number_format($hp, 0, ",", ".")."$kasir

"); + print("
"); + + print(""); + print(""); + print("
Total Titipan Bon : ".number_format($ttJumlah['hp'],0,',','.')."
Saldo Titipan Bon : ".number_format($ttJumlah['hp']-$ttJumlah['rp'],0,',','.')."
"); + }else{ + echo "Data tidak ditemukan!"; + } + } + } +?> + diff --git a/old-source/bon/menu.php b/old-source/bon/menu.php new file mode 100644 index 0000000..ad41080 --- /dev/null +++ b/old-source/bon/menu.php @@ -0,0 +1,130 @@ + + + + + +
+ +
diff --git a/old-source/bon/rekapbon.php b/old-source/bon/rekapbon.php new file mode 100644 index 0000000..5e104f2 --- /dev/null +++ b/old-source/bon/rekapbon.php @@ -0,0 +1,112 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Rekap Bon +
+
+
+ + + + +
Rentang Tanggal: s/d
Kode Pelanggan :
+
+
+
+
+
+ +
+
Cari Pelanggan
+
+ +
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + +
+ + diff --git a/old-source/bon/rekappj.php b/old-source/bon/rekappj.php new file mode 100644 index 0000000..09af12b --- /dev/null +++ b/old-source/bon/rekappj.php @@ -0,0 +1,112 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Rekap Penanggungjawab Bon +
+
+
+ + + + +
Rentang Tanggal: s/d
Kode Pelanggan :
+
+
+
+
+ +
+
Cari Pelanggan
+
+ +
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + +
+ + + diff --git a/old-source/bon/returbon.php b/old-source/bon/returbon.php new file mode 100644 index 0000000..ae7ec1c --- /dev/null +++ b/old-source/bon/returbon.php @@ -0,0 +1,112 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Rekap Retur Bon +
+
+
+ + + + +
Rentang Tanggal: s/d
Kode Pelanggan :
+
+
+
+
+
+ +
+
Cari Pelanggan
+
+ +
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + +
+ + diff --git a/old-source/bon/rincian_jual.php b/old-source/bon/rincian_jual.php new file mode 100644 index 0000000..9d139fd --- /dev/null +++ b/old-source/bon/rincian_jual.php @@ -0,0 +1,85 @@ +"; + echo "table.tbl {width:750px;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + + $nonota = $_GET['nota']; + $nonotabon = $nonota; + bon($nonotabon); + +function bon($nonotabon) +{ + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Rekap Bon*/ + $query = "SELECT d.`kd_brg`, d.`nomor`, b.nama_barang,d.`jumlah`, d.`diskon`, + d.`hrg_satuan`,(d.`hrg_satuan`*d.`jumlah`) subtotal,d.`kd_pram` + FROM d_bon d,barang b + where d.`kd_brg`=b.kode_barang + and d.no_bon = '$nonotabon'"; + $query2 = "select m.no_bon,m.tgl_bon,m.kode_plg, + m.jumlah_total,m.diskon, + m.bank,m.no_kartu,m.kasir + from m_bon m + where m.no_bon = '$nonotabon'"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdbrg,$nomor,$nmbrg,$jum,$diskon,$hj,$subtotal,$kdpram); + + print("
"); + print("

Rincian Penjualan


"); + print("

"); + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$nota,$tglnota,$kdcust,$tot,$disc,$bank,$kartu,$kasir); + while(mysqli_stmt_fetch($stmt2)){ + print("Nomor Nota : ".$nota."
"); + print("Tanggal Nota : ".$tglnota."
"); + print("Plg : ".$kdcust."
"); + print("Total : ".number_format($tot,0,',','.')."
"); + print("Jumlah uang : ".number_format($totuang,0,',','.')."
"); + print("Discount : ".$disc."
"); + print("Bank : ".$bank."
"); + print("No.kartu : ".$kartu."
"); + print("Kasir : ".$kasir."

"); + } + } + } + + + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + print(""); + } + + print("
Kode Brg.NomorNamaJumlDiscHJSub TotalKd Pram
$kdbrg$nomor$nmbrg$jum".$diskon."".number_format($hj,0,',','.')."".number_format($subtotal,0,',','.')."$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + print("

"); + } +} + + + +?> diff --git a/old-source/bon/rincikomisi.php b/old-source/bon/rincikomisi.php new file mode 100644 index 0000000..4edde0f --- /dev/null +++ b/old-source/bon/rincikomisi.php @@ -0,0 +1,94 @@ + + + + + Amigo Group :: Pengadaan Barang + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
Rekap Rinci Komisi Bon
+
+
+
+ + + +
Rentang Tanggal: -
Kode Pelanggan :
+
+
+
+
+
+
+
Cari Pelanggan
+
+
+
+ + + + +
Nama: +
+
+
+ Hasil pencarian +
+
+
+
+ + +
+ + diff --git a/old-source/bon/saldobon.php b/old-source/bon/saldobon.php new file mode 100644 index 0000000..bba012c --- /dev/null +++ b/old-source/bon/saldobon.php @@ -0,0 +1,81 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Saldo Bon +
+
+
+ + + +
Jatuh Tempo AK2 :
+
+
+
+
+
+ + +
+ + diff --git a/old-source/bon/saldobonperiode.php b/old-source/bon/saldobonperiode.php new file mode 100644 index 0000000..a5e748e --- /dev/null +++ b/old-source/bon/saldobonperiode.php @@ -0,0 +1,88 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Rekap Saldo Bon Per Periode +
+
+
+ + +
Rentang Tanggal: s/d +
+
+
+
+
+
+ + +
+ + diff --git a/old-source/bon/titipan.php b/old-source/bon/titipan.php new file mode 100644 index 0000000..ed73a5f --- /dev/null +++ b/old-source/bon/titipan.php @@ -0,0 +1,113 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Rekap Titipan Bon +
+
+
+ + + + +
Rentang Tanggal: s/d
Kode Pelanggan :
+
+
+
+
+
+ +
+
Cari Pelanggan
+
+ +
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + +
+ + + diff --git a/old-source/convert_hp.php b/old-source/convert_hp.php new file mode 100644 index 0000000..7d7055d --- /dev/null +++ b/old-source/convert_hp.php @@ -0,0 +1,16 @@ +query("SELECT id,harga_pokok FROM `no_barang` ORDER BY id"); + if($qry_select->num_rows > 0){ + while($pembelian = $qry_select->fetch_array(MYSQLI_ASSOC)){ + $id = $pembelian['id']; + $harga_pokok = $pembelian['harga_pokok']; + $harga_pokok_new = convHrgP($harga_pokok); + $Insert_to_dbeli = $mysqli_dbeli->prepare("UPDATE no_barang SET harga_pokok = '$harga_pokok_new' where id = '$id'"); + $Insert_to_dbeli->execute(); + echo $harga_pokok." ".$harga_pokok_new."
"; + } + } +?> \ No newline at end of file diff --git a/old-source/css/css.css b/old-source/css/css.css new file mode 100644 index 0000000..6d1354b --- /dev/null +++ b/old-source/css/css.css @@ -0,0 +1,86 @@ +body { + margin: 0; + padding: 0; + font: 10pt Arial, Tahoma, Helvetica, sans-serif; + color: #7e7e7e; + line-height: 16px; + background-color: #EBE999; +} + +a { + color: #33ADDB; + background-color: inherit; +} + +a:hover { + color: #575757; + background-color: inherit; +} + +p { + padding: 2px 0 5px; + margin: 0; +} + +legend { + font-size: 1.2em; +} + +#content { + clear:both; + margin: 0px auto; + width: 1180px; +} + +.headermenu { + padding-top:7px; + background-color:#FABB55; + clear: both; + height: 35px; + width:inherit; + border-top: 3px solid #000000; +} +.c_content { + float: right; + width: 1160px; + margin: 5px 0 3px 0; + padding: 0px 10px 10px 10px; + color: #000; + background-color: #FFFFFF; +} + +.footer { + clear: both; + color: #999999; + background-color: #FFFFFF; + padding: 10px 0 10px 0; + text-align: center; + font-size:.8em; + line-height: 13px; +} + +.footer a { + text-decoration: underline; +} + +p#top{ + padding-top:5px; + display:block; + color:#FFF; + text-align:center; + font-size:2em; + font-weight:bold; +} + +p#alertmsg{ + color:#FF0000; +} + +div#ovlay{ + text-align:center; +} + +ol.catatan{ + color:#FF0000; + font-weight:bold; +} \ No newline at end of file diff --git a/old-source/css/dialogcustom.css b/old-source/css/dialogcustom.css new file mode 100644 index 0000000..5fe49c2 --- /dev/null +++ b/old-source/css/dialogcustom.css @@ -0,0 +1,71 @@ +div.whiteOverlay { background-color: #000; } +div.jqDrag {cursor: move;} + +/* jqmModal dialog CSS courtesy of; + Brice Burgess */ + +div.jqmDialog { + display: none; + position: fixed; + top: 10%; + left: 37%; + margin-left: -200px; + width: 800px; + overflow: hidden; + font-family:verdana,tahoma,helvetica; + border:1px solid #FFF; + font-size: 12px; + z-index:999; +} + +div.jqmDialog a { + color:#cc0000; +} +div.jqmDialog a:hover { + text-decoration: none; +} +/* Fixed posistioning emulation for IE6 + Star selector used to hide definition from browsers other than IE6 + For valid CSS, use a conditional include instead */ +* html div.jqmDialog { + position: absolute; + top: expression((document.documentElement.scrollTop || document.body.scrollTop) + Math.round(17 * (document.documentElement.offsetHeight || document.body.clientHeight) / 100) + 'px'); +} + + +/* [[[ Title / Top Classes ]]] */ +div.jqmdTC { + background-color: #cc0000; + color: #FFF; + padding: 7px 22px 5px 5px; + font-family:"sans serif",verdana,tahoma,helvetica; + font-weight: bold; + * zoom: 1; +} + +/* [[[ Body / Message Classes ]]] */ +div.jqmdBC { + padding: 7px 7px 7px; + height: 350px; + overflow: auto; + background-color: #fff; +} + +div.jqmdMSG { color: #000; } + +/* [[[ Button classes ]]] */ +input.jqmdX { + position: absolute; + right: 7px; + top: 4px; + padding: 0 0 0 19px; + height: 19px; + width: 0px; + background: url(../images/close.gif) no-repeat top left; + overflow: hidden; +} +input.jqmdXFocus {background-position: bottom left; outline: none;} + +div.jqmdBC button, div.jqmdBC input[type="submit"] { + cursor: pointer; +} \ No newline at end of file diff --git a/old-source/css/flora.datepicker.css b/old-source/css/flora.datepicker.css new file mode 100644 index 0000000..68a31e5 --- /dev/null +++ b/old-source/css/flora.datepicker.css @@ -0,0 +1,216 @@ +/* Main Flora Style Sheet for jQuery UI ui-datepicker */ +#ui-datepicker-div, .ui-datepicker-inline { + font-family: Arial,Helvetica,sans-serif; + font-size: 14px; + padding: 0; + margin: 0; + background: #E0F4D7; + width: 185px; +} +#ui-datepicker-div { + display: none; + border: 1px solid #FF9900; + z-index: 10; +} +.ui-datepicker-inline { + float: left; + display: block; + border: 0; +} +.ui-datepicker-rtl { + direction: rtl; +} +.ui-datepicker-dialog { + padding: 5px !important; + border: 4px ridge #83C948 !important; +} +button.ui-datepicker-trigger { + width: 25px; +} +img.ui-datepicker-trigger { + margin: 2px; + vertical-align: middle; +} +.ui-datepicker-prompt { + float: left; + padding: 2px; + background: #E0F4D7; + color: #000; +} +*html .ui-datepicker-prompt { + width: 185px; +} +.ui-datepicker-control, .ui-datepicker-links, .ui-datepicker-header, .ui-datepicker { + clear: both; + float: left; + width: 100%; + color: #FFF; +} +.ui-datepicker-control { + background: #FF9900; + padding: 2px 0px; +} +.ui-datepicker-links { + background: #E0F4D7; + padding: 2px 0px; +} +.ui-datepicker-control, .ui-datepicker-links { + font-weight: bold; + font-size: 80%; + letter-spacing: 1px; +} +.ui-datepicker-links label { + padding: 2px 5px; + color: #888; +} +.ui-datepicker-clear, .ui-datepicker-prev { + float: left; + width: 34%; +} +.ui-datepicker-rtl .ui-datepicker-clear, .ui-datepicker-rtl .ui-datepicker-prev { + float: right; + text-align: right; +} +.ui-datepicker-current { + float: left; + width: 30%; + text-align: center; +} +.ui-datepicker-close, .ui-datepicker-next { + float: right; + width: 34%; + text-align: right; +} +.ui-datepicker-rtl .ui-datepicker-close, .ui-datepicker-rtl .ui-datepicker-next { + float: left; + text-align: left; +} +.ui-datepicker-header { + padding: 1px 0 3px; + background: #83C948; + text-align: center; + font-weight: bold; + height: 1.3em; +} +.ui-datepicker-header select { + background: #83C948; + color: #000; + border: 0px; + font-weight: bold; +} +.ui-datepicker { + background: #CCC; + text-align: center; + font-size: 100%; +} +.ui-datepicker a { + display: block; + width: 100%; +} +.ui-datepicker-title-row { + background: #B1DB87; + color: #000; +} +.ui-datepicker-title-row .ui-datepicker-week-end-cell { + background: #B1DB87; +} +.ui-datepicker-days-row { + background: #FFF; + color: #666; +} +.ui-datepicker-week-col { + background: #B1DB87; + color: #000; +} +.ui-datepicker-days-cell { + color: #000; + border: 1px solid #DDD; +} +.ui-datepicker-days-cell a { + display: block; +} +.ui-datepicker-week-end-cell { + background: #E0F4D7; +} +.ui-datepicker-unselectable { + color: #888; +} +.ui-datepicker-week-over, .ui-datepicker-week-over .ui-datepicker-week-end-cell { + background: #B1DB87 !important; +} +.ui-datepicker-days-cell-over, .ui-datepicker-days-cell-over.ui-datepicker-week-end-cell { + background: #FFF !important; + border: 1px solid #777; +} +* html .ui-datepicker-title-row .ui-datepicker-week-end-cell { + background: #B1DB87 !important; +} +* html .ui-datepicker-week-end-cell { + background: #E0F4D7 !important; + border: 1px solid #DDD !important; +} +* html .ui-datepicker-days-cell-over { + background: #FFF !important; + border: 1px solid #777 !important; +} +* html .ui-datepicker-current-day { + background: #83C948 !important; +} +.ui-datepicker-today { + background: #B1DB87 !important; +} +.ui-datepicker-current-day { + background: #83C948 !important; +} +.ui-datepicker-status { + background: #E0F4D7; + width: 100%; + font-size: 80%; + text-align: center; +} +#ui-datepicker-div a, .ui-datepicker-inline a { + cursor: pointer; + margin: 0; + padding: 0; + background: none; + color: #000; +} +.ui-datepicker-inline .ui-datepicker-links a { + padding: 0 5px !important; +} +.ui-datepicker-control a, .ui-datepicker-links a { + padding: 2px 5px !important; + color: #000 !important; +} +.ui-datepicker-title-row a { + color: #000 !important; +} +.ui-datepicker-control a:hover { + background: #FDD !important; + color: #333 !important; +} +.ui-datepicker-links a:hover, .ui-datepicker-title-row a:hover { + background: #FFF !important; + color: #333 !important; +} +.ui-datepicker-multi .ui-datepicker { + border: 1px solid #83C948; +} +.ui-datepicker-one-month { + float: left; + width: 185px; +} +.ui-datepicker-new-row { + clear: left; +} +.ui-datepicker-cover { + display: none; + display/**/: block; + position: absolute; + z-index: -1; + filter: mask(); + top: -4px; + left: -4px; + width: 193px; + height: 200px; +} diff --git a/old-source/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png b/old-source/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png new file mode 100644 index 0000000..954e22d Binary files /dev/null and b/old-source/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png differ diff --git a/old-source/css/images/ui-bg_diagonals-thick_20_666666_40x40.png b/old-source/css/images/ui-bg_diagonals-thick_20_666666_40x40.png new file mode 100644 index 0000000..64ece57 Binary files /dev/null and b/old-source/css/images/ui-bg_diagonals-thick_20_666666_40x40.png differ diff --git a/old-source/css/images/ui-bg_diagonals-thick_75_f3d8d8_40x40.png b/old-source/css/images/ui-bg_diagonals-thick_75_f3d8d8_40x40.png new file mode 100644 index 0000000..13a229f Binary files /dev/null and b/old-source/css/images/ui-bg_diagonals-thick_75_f3d8d8_40x40.png differ diff --git a/old-source/css/images/ui-bg_dots-small_65_a6a6a6_2x2.png b/old-source/css/images/ui-bg_dots-small_65_a6a6a6_2x2.png new file mode 100644 index 0000000..500070b Binary files /dev/null and b/old-source/css/images/ui-bg_dots-small_65_a6a6a6_2x2.png differ diff --git a/old-source/css/images/ui-bg_flat_0_333333_40x100.png b/old-source/css/images/ui-bg_flat_0_333333_40x100.png new file mode 100644 index 0000000..2f2c7a4 Binary files /dev/null and b/old-source/css/images/ui-bg_flat_0_333333_40x100.png differ diff --git a/old-source/css/images/ui-bg_flat_100_eeeeee_40x100.png b/old-source/css/images/ui-bg_flat_100_eeeeee_40x100.png new file mode 100644 index 0000000..e44f861 Binary files /dev/null and b/old-source/css/images/ui-bg_flat_100_eeeeee_40x100.png differ diff --git a/old-source/css/images/ui-bg_flat_10_000000_40x100.png b/old-source/css/images/ui-bg_flat_10_000000_40x100.png new file mode 100644 index 0000000..abdc010 Binary files /dev/null and b/old-source/css/images/ui-bg_flat_10_000000_40x100.png differ diff --git a/old-source/css/images/ui-bg_flat_15_cc0000_40x100.png b/old-source/css/images/ui-bg_flat_15_cc0000_40x100.png new file mode 100644 index 0000000..360dbe3 Binary files /dev/null and b/old-source/css/images/ui-bg_flat_15_cc0000_40x100.png differ diff --git a/old-source/css/images/ui-bg_flat_65_ffffff_40x100.png b/old-source/css/images/ui-bg_flat_65_ffffff_40x100.png new file mode 100644 index 0000000..ac8b229 Binary files /dev/null and b/old-source/css/images/ui-bg_flat_65_ffffff_40x100.png differ diff --git a/old-source/css/images/ui-bg_flat_75_ffffff_40x100.png b/old-source/css/images/ui-bg_flat_75_ffffff_40x100.png new file mode 100644 index 0000000..ac8b229 Binary files /dev/null and b/old-source/css/images/ui-bg_flat_75_ffffff_40x100.png differ diff --git a/old-source/css/images/ui-bg_glass_100_f6f6f6_1x400.png b/old-source/css/images/ui-bg_glass_100_f6f6f6_1x400.png new file mode 100644 index 0000000..9b383f4 Binary files /dev/null and b/old-source/css/images/ui-bg_glass_100_f6f6f6_1x400.png differ diff --git a/old-source/css/images/ui-bg_glass_100_fdf5ce_1x400.png b/old-source/css/images/ui-bg_glass_100_fdf5ce_1x400.png new file mode 100644 index 0000000..a23baad Binary files /dev/null and b/old-source/css/images/ui-bg_glass_100_fdf5ce_1x400.png differ diff --git a/old-source/css/images/ui-bg_glass_55_fbf8ee_1x400.png b/old-source/css/images/ui-bg_glass_55_fbf8ee_1x400.png new file mode 100644 index 0000000..fb056eb Binary files /dev/null and b/old-source/css/images/ui-bg_glass_55_fbf8ee_1x400.png differ diff --git a/old-source/css/images/ui-bg_glass_65_ffffff_1x400.png b/old-source/css/images/ui-bg_glass_65_ffffff_1x400.png new file mode 100644 index 0000000..42ccba2 Binary files /dev/null and b/old-source/css/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/old-source/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png b/old-source/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png new file mode 100644 index 0000000..1b1972b Binary files /dev/null and b/old-source/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png differ diff --git a/old-source/css/images/ui-bg_highlight-hard_100_f6f6f6_1x100.png b/old-source/css/images/ui-bg_highlight-hard_100_f6f6f6_1x100.png new file mode 100644 index 0000000..2656c08 Binary files /dev/null and b/old-source/css/images/ui-bg_highlight-hard_100_f6f6f6_1x100.png differ diff --git a/old-source/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png b/old-source/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png new file mode 100644 index 0000000..f127367 Binary files /dev/null and b/old-source/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png differ diff --git a/old-source/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png b/old-source/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png new file mode 100644 index 0000000..359397a Binary files /dev/null and b/old-source/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png differ diff --git a/old-source/css/images/ui-icons_004276_256x240.png b/old-source/css/images/ui-icons_004276_256x240.png new file mode 100644 index 0000000..46ae6ca Binary files /dev/null and b/old-source/css/images/ui-icons_004276_256x240.png differ diff --git a/old-source/css/images/ui-icons_222222_256x240.png b/old-source/css/images/ui-icons_222222_256x240.png new file mode 100644 index 0000000..ee039dc Binary files /dev/null and b/old-source/css/images/ui-icons_222222_256x240.png differ diff --git a/old-source/css/images/ui-icons_228ef1_256x240.png b/old-source/css/images/ui-icons_228ef1_256x240.png new file mode 100644 index 0000000..10e3631 Binary files /dev/null and b/old-source/css/images/ui-icons_228ef1_256x240.png differ diff --git a/old-source/css/images/ui-icons_cc0000_256x240.png b/old-source/css/images/ui-icons_cc0000_256x240.png new file mode 100644 index 0000000..80cbad5 Binary files /dev/null and b/old-source/css/images/ui-icons_cc0000_256x240.png differ diff --git a/old-source/css/images/ui-icons_ef8c08_256x240.png b/old-source/css/images/ui-icons_ef8c08_256x240.png new file mode 100644 index 0000000..35bb8ef Binary files /dev/null and b/old-source/css/images/ui-icons_ef8c08_256x240.png differ diff --git a/old-source/css/images/ui-icons_ffd27a_256x240.png b/old-source/css/images/ui-icons_ffd27a_256x240.png new file mode 100644 index 0000000..4a48e64 Binary files /dev/null and b/old-source/css/images/ui-icons_ffd27a_256x240.png differ diff --git a/old-source/css/images/ui-icons_ffffff_256x240.png b/old-source/css/images/ui-icons_ffffff_256x240.png new file mode 100644 index 0000000..bef5178 Binary files /dev/null and b/old-source/css/images/ui-icons_ffffff_256x240.png differ diff --git a/old-source/css/jqModal.css b/old-source/css/jqModal.css new file mode 100644 index 0000000..48df2cb --- /dev/null +++ b/old-source/css/jqModal.css @@ -0,0 +1,37 @@ +/* jqModal base Styling courtesy of; + Brice Burgess */ + +/* The Window's CSS z-index value is respected (takes priority). If none is supplied, + the Window's z-index value will be set to 3000 by default (via jqModal.js). */ + +.jqmWindow { + display: none; + z-index: 200; + position: fixed; + top: 17%; + left: 50%; + + margin-left: -300px; + width: 600px; + + background-color: #EEE; + color: #333; + border: 1px solid black; + padding: 12px; +} + +.jqmOverlay { background-color: #000; } + +/* Background iframe styling for IE6. Prevents ActiveX bleed-through ( + + + + + + + Group Product + : + + + + + + Nama Sub Group Product + : + + + + +
+ + + +
+ +
+ +
+
Cari Sub Group Product
+
+ +
+
+ + + + +
Group Product:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + diff --git a/old-source/footer.php b/old-source/footer.php new file mode 100644 index 0000000..7786c11 --- /dev/null +++ b/old-source/footer.php @@ -0,0 +1,4 @@ +© Copyright 2014, LPPTI | Design: Daniel Susanto - dan + | v.1901-15

"; +?> diff --git a/old-source/func_lib.php b/old-source/func_lib.php new file mode 100644 index 0000000..34b6ca6 --- /dev/null +++ b/old-source/func_lib.php @@ -0,0 +1,1136 @@ +query($query); + $mysqli->close; + } + + function runningQuery($query){ + $mysqli = new mysqli (HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query($query); + if($data->num_rows > 0) + { + return $data; + } + else + return false; + $mysqli->close; + } + + function runQueryPusat($query){ + $mysqli = new mysqli (HOST_PUSAT,USER_PUSAT,PASSWORD_PUSAT,DB_PUSAT); + $data = $mysqli->query($query); + $mysqli->close; + } + + function closepusat($connpusat){ + mysqli_close($connpusat); + } + + function tutupKoneksi($conn){ + mysqli_close($conn); + } + + function right($value, $count){ + return substr($value, ($count*-1)); + } + + function left($string, $count){ + return substr($string, 0, $count); + } + + function getConn(){ + return $conn; + } + + function cekUser($user,$pass){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT * FROM karyawan WHERE username = ? AND password = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,"ss",$user,$pass); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + return true; + }else{ + return false; + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + mysqli_close($conn); + }else{ + return false; + mysqli_close($conn); + } + }else{ + return false; + } + } + + function cekAssko($user,$pass){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT id_pekerjaan FROM karyawan WHERE username = ? AND password= ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,"ss",$user,$pass); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + mysqli_stmt_bind_result($stmt,$type); + + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$type); + while(mysqli_stmt_fetch($stmt)){ + if($type=='Asisten Pemimpin Toko') + return true; + else + return false; + } + }else{ + return false; + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + mysqli_close($conn); + }else{ + return false; + mysqli_close($conn); + } + }else{ + return false; + } + } + + function cekAdmin($user,$pass){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT id_pekerjaan FROM karyawan WHERE username = ? AND password= ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,"ss",$user,$pass); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + mysqli_stmt_bind_result($stmt,$type); + + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$type); + while(mysqli_stmt_fetch($stmt)){ + if($type=='Petugas Administrasi') + return true; + else + return false; + } + }else{ + return false; + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + mysqli_close($conn); + }else{ + return false; + mysqli_close($conn); + } + }else{ + return false; + } + } + + function cekPemko($user,$pass){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT id_pekerjaan FROM karyawan WHERE username = ? AND password= ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,"ss",$user,$pass); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + mysqli_stmt_bind_result($stmt,$type); + + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$type); + while(mysqli_stmt_fetch($stmt)){ + if($type=='Pemimpin Toko') + return true; + else + return false; + } + }else{ + return false; + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + mysqli_close($conn); + }else{ + return false; + mysqli_close($conn); + } + }else{ + return false; + } + } + // -----------------FUNGSI GENERATE NO ORDER------------------------- + + function noOrder(){ + //$param = "kd_toko"; + $tahun = date('y'); + if(bukaKoneksi()){ + global $conn; + //$nilaine = $kdToko."%"; + //$query2 = "SELECT no_order FROM m_order WHERE no_order like ? ORDER BY no_order DESC limit 1"; + $query2 = "SELECT no_order FROM m_order ORDER BY no_order DESC limit 1"; + if($stmt2 = mysqli_prepare($conn,$query2)){ + //mysqli_stmt_bind_param($stmt2,"s",$nilaine); + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek = mysqli_stmt_num_rows($stmt2); + mysqli_stmt_bind_result($stmt2,$noOrder); + if($cek == 0){//jika belum ada data, no_order dimulai dari awal + $str = "$kdToko"."$tahun"."000001"; + echo $str; + }else{ + while(mysqli_stmt_fetch($stmt2)){ + $noOrdere = $noOrder; + } + $thn = substr($noOrdere,2,2); + $kdToko = substr($noOrdere,0,2); + if($thn!=date('y')){//jika ganti tahun + $thn = date('y'); + $no_urut = "000001"; + $str = "$kdToko"."$thn"."$no_urut"; + echo $str; + }else{//jika pada tahun yang sama + + $no_urut = intval(substr($noOrdere,4,6)); + $no_urut++; + $strUrut = strlen($no_urut); + for($i=1;$i<=(6-$strUrut);$i++){ + $no_urut = "0" . $no_urut; + } + $str = "$kdToko"."$thn"."$no_urut"; + + if(cekTempOrder($str)){ + $strAkhir = selectTempOrder(); + $urutTemp = intval(substr($strAkhir,4,6)); + $urutTemp++; + $strTemp = strlen($urutTemp); + for($i=1;$i<=(6-$strTemp);$i++){ + $urutTemp = "0" . $urutTemp; + } + $strBaru = "$kdToko"."$thn"."$urutTemp"; + $str = $strBaru; + } + insertTempOrder($str); + echo $str; + } + + } + mysqli_stmt_free_result($stmt2); + mysqli_stmt_close($stmt2); + } + tutupKoneksi($conn); + } + } + //--------------------------------------------------------------------------------- + function getKdToko($nama,$pass){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT d.id_department FROM department d, karyawan k WHERE + d.id_department = k.id_department AND username = ? AND password = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,"ss",$nama,$pass); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kd); + while(mysqli_stmt_fetch($stmt)){ + return $kd; + } + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + } + tutupKoneksi($conn); + } + } + function getNmToko($nama,$pass){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT d.department FROM department d, karyawan k WHERE + d.id_department = k.id_department AND username = ? AND password = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,"ss",$nama,$pass); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kd); + while(mysqli_stmt_fetch($stmt)){ + return $kd; + } + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + } + tutupKoneksi($conn); + } + } + function cariIdRncO($kd_str,$kd_supp){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT distinct(m.kode_strip),d.kode_supplier,m.id + FROM m_rencana_beli m,d_rencana_beli d + WHERE d.id = m.id AND m.kode_strip = ? AND d.kode_supplier = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,"ss",$kd_str,$kd_supp); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + return true; + }else{ + return false; + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + } + tutupKoneksi($conn); + } + } + + function getNIK($nama,$pass){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT nik FROM karyawan WHERE username = ? AND password = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,"ss",$nama,$pass); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$nik); + while(mysqli_stmt_fetch($stmt)){ + return $nik; + } + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + } + tutupKoneksi($conn); + } + } +// ---------------------------------source code original , jgn dihapuss!!--------------------------------------- +/* function labeling($strip,$merk,$kp,$subkat,$bulan,$tahun,$hp,$no){ + if(bukaKoneksi()){ + global $conn; + $kd_merk = $strip.$merk; + $incBrg = $strip.$merk.$kp."%"; + $query = "SELECT kode_barang FROM barang WHERE kode_strip = ? AND kode_merk = ? AND ked_produk = ? ORDER BY kode_barang DESC limit 1"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'sss',$strip,$kd_merk,$kp); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + mysqli_stmt_bind_result($stmt,$kdBrg); + if($cek == 0){//jika ga ada data dengan kriteria yang ada + $str = $strip.$merk.$kp.$subkat."000"; + return $str; + }else{ + $query1 = "SELECT bulan, tahun, id_gabungan FROM barang WHERE kode_barang = ?"; + while(mysqli_stmt_fetch($stmt)){ + if($stmt1 = mysqli_prepare($conn,$query1)){ + mysqli_stmt_bind_param($stmt1,'s',$kdBrg); + mysqli_stmt_execute($stmt1); + mysqli_stmt_store_result($stmt1); + $cek1 = mysqli_stmt_num_rows($stmt1); + + if($cek1 > 0){ + mysqli_stmt_bind_result($stmt1,$bln,$thn,$id_gabungan); + while(mysqli_stmt_fetch($stmt1)){ + if($bln==$bulan && $thn==$tahun){//jika kode barang ada di bulan dan tahun yang sama + if(cekHP($hp,$id_gabungan,$no)){//jika HP nya sama + return $kdBrg; + }else{ + $noUrut = substr($kdBrg,6,3);//untuk di increment + $index = getIdUrut($noUrut);//get index nya + $index++;//increment index + $Urut = getNoUrut($index);//get no urut untuk index yang disebut + $str = $strip.$merk.$kp.$subkat.$Urut; + return $str; + } + }else{//jika di bulan dan tahun yang berbeda maka increment + $noUrut = substr($kdBrg,6,3);//untuk di increment + /*if($noUrut == "999"){ //jika sudah 999, maka mulai gunakan kombinasi huruf angka + $noUrut = "000"; + }else{//jika belum 999 maka increment + $noUrut = intval($noUrut); + $noUrut++; + $strUrut = strlen($noUrut); + for($i=1;$i<=(3-$strUrut);$i++){ + $noUrut = "0".$noUrut; + } + }*/ +/* $index = getIdUrut($noUrut);//get index nya + $index++;//increment index + //if($index > 999){//jika index/id lebih besar dari 999 gunakan urut kombinasi huruf angka + $noUrut = getNoUrut($index);//get no urut untuk index yang disebut + + $str = $strip.$merk.$kp.$subkat.$noUrut; + return $str; + } + } + } + } + } + } + } + } + } */ + + function labeling($strip,$merk,$kp,$subkat,$bulan,$tahun,$hp,$no){ + if(bukaKoneksi()){ + global $conn; + $kd_merk = $strip.$merk; + $incBrg = $strip.$merk.$kp."%"; + //$query = "SELECT kode_barang FROM barang WHERE kode_strip = ? AND kode_merk = ? AND ked_produk = ? ORDER BY kode_barang DESC limit 1"; + $query = "SELECT b.kode_barang + FROM barang b FORCE INDEX (kode_strip,kode_merk,ked_produk),nomor_urut n FORCE INDEX (urut) + where n.urut = right(b.kode_barang,3) + and kode_strip = ? AND kode_merk = ? AND ked_produk = ? + ORDER BY n.id DESC limit 1"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'sss',$strip,$kd_merk,$kp); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + mysqli_stmt_bind_result($stmt,$kdBrg); + if($cek == 0){//jika ga ada data dengan kriteria yang ada + $str = $strip.$merk.$kp.$subkat."000"; + return $str; + }else{ + $query1 = "SELECT bulan, tahun, id_gabungan FROM barang WHERE kode_barang = ?"; + while(mysqli_stmt_fetch($stmt)){ + if($stmt1 = mysqli_prepare($conn,$query1)){ + mysqli_stmt_bind_param($stmt1,'s',$kdBrg); + mysqli_stmt_execute($stmt1); + mysqli_stmt_store_result($stmt1); + $cek1 = mysqli_stmt_num_rows($stmt1); + + if($cek1 > 0){ + mysqli_stmt_bind_result($stmt1,$bln,$thn,$id_gabungan); + while(mysqli_stmt_fetch($stmt1)){ + if($bln==$bulan && $thn==$tahun){//jika kode barang ada di bulan dan tahun yang sama + if(cekHP($hp,$id_gabungan,$no)){//jika HP nya sama + return $kdBrg; + }else{ + $noUrut = substr($kdBrg,6,3);//untuk di increment + $index = getIdUrut($noUrut);//get index nya + $index++;//increment index + $Urut = getNoUrut($index);//get no urut untuk index yang disebut + $str = $strip.$merk.$kp.$subkat.$Urut; + return $str; + } + }else{//jika di bulan dan tahun yang berbeda maka increment + $noUrut = substr($kdBrg,6,3);//untuk di increment + $index = getIdUrut($noUrut);//get index nya + $index++;//increment index + $noUrut = getNoUrut($index);//get no urut untuk index yang disebut + $str = $strip.$merk.$kp.$subkat.$noUrut; + return $str; + } + } + } + } + } + } + } + } + } + + //----------------------------------FUNGSI FORMAT TANGGAL ------------------------------------------------------ + function encTgl($tgl){ // ke format dd-mm-yyyy + $y = substr($tgl,0,4); + $m = substr($tgl,5,2); + $d = substr($tgl,8,2); + return $d."-".$m."-".$y; + } + function decTgl($tgl){// ke format yyyy-mm-dd + $d = substr($tgl,0,2); + $m = substr($tgl,3,2); + $y = substr($tgl,6,4); + return $y."-".$m."-".$d; + } + + function convHrgP($hrgP){ + $kode = ""; + for($i=0;$i 0){ + mysqli_stmt_bind_result($stmt,$kd_merk); + while(mysqli_stmt_fetch($stmt)){ + return $kd_merk; + } + } + } + } + } + //-----------------------------------------------FUNGSI UNTUK GET NAMA SUPPLIER---------------------------------- + function getNamaSup($kd){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT nama_supplier FROM supplier WHERE kd_supplier = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'s',$kd); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$nmSup); + while(mysqli_stmt_fetch($stmt)){ + return $nmSup; + } + } + } + } + } + //--------------------------------------------SIMPAN BARANG----------------------------------------------------- + function cekNoBrg($id,$ukur){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT count(*) FROM no_barang WHERE id_gabungan = ? AND nomor = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'ss',$id,$ukur); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + mysqli_stmt_bind_result($stmt,$jumlah); + while(mysqli_stmt_fetch($stmt)){ + if($jumlah > 0){//berarti sudah ada + return true; + }else{ + return false; + } + } + } + } + } + + function cekKodeBrg($kdBrg){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT kode_barang FROM barang WHERE kode_barang = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,"s",$kdBrg); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){//berarti sudah ada + return true; + }else{ + return false; + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + } + } + } + + /*function updateStok($id,$ukur,$jml){ + if(bukaKoneksi()){ + global $conn; + $query = "UPDATE no_barang SET stok += ? WHERE id_gabungan = ? AND nomor = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'iss',$jml,$id,$ukur); + mysqli_stmt_execute($stmt); + $cek = mysqli_stmt_affected_rows($stmt); + if($cek > 0){ + return true; + }else{ + return false; + } + mysqli_stmt_close($stmt); + } + } + }*/ + + function insertNoBrg($id,$nomor,$hrgP,$hjF,$stokMin,$jumlah){ + if(bukaKoneksi()){ + global $conn; + $query = "INSERT INTO no_barang(id_gabungan,nomor,harga_pokok,harga_jual,stok_min,stok) VALUES(?,?,?,?,?,?)"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,"sssiii",$id,$nomor,$hrgP,$hjF,$stokMin,$jumlah); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_affected_rows($stmt); + if($cek > 0){ + return true; + }else{ + return false; + } + mysqli_stmt_close($stmt); + } + } + } + + function insertKdBrg($kode,$nmBrg,$kdToko,$tahun,$bulan,$id,$strip,$supp,$kp,$kdmerk,$posBrg,$kdLama){ + if(bukaKoneksi()){ + global $conn; + $query = "INSERT INTO barang(kode_barang,nama_barang,kode_toko,tahun,bulan,id_gabungan,kode_strip,kode_supplier + ,ked_produk,kode_merk,kelompok,kode_lama) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,"sssiisssssss",$kode,$nmBrg,$kdToko,$tahun,$bulan,$id,$strip,$supp,$kp,$kdmerk,$posBrg,$kdLama); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_affected_rows($stmt); + if($cek > 0){ + return true; + }else{ + return false; + } + mysqli_stmt_close($stmt); + } + } + } + + //-------------------------------------------FUNGSI MENGAMBIL NO URUT HURUF_ANGKA------------------------------ + + function getNoUrut($index){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT urut FROM nomor_urut WHERE id = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'i',$index); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$urut); + while(mysqli_stmt_fetch($stmt)){ + return $urut; + } + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + } + } + } + + function getIdUrut($urut){//fungsi get id untuk no urut di tabel nomor_urut + if(bukaKoneksi()){ + global $conn; + $query = "SELECT id FROM nomor_urut WHERE urut = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'s',$urut); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$index); + while(mysqli_stmt_fetch($stmt)){ + return $index; + } + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + } + } + } + + function cekHP($hp,$id_gabungan,$no){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT harga_pokok FROM no_barang WHERE id_gabungan = ? AND nomor = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'ss',$id_gabungan,$no); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$hrgP); + while(mysqli_stmt_fetch($stmt)){ + if($hrgP == $hp){ + return true; + }else{ + return false; + } + } + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + } + } + } + //------------------------------FUNGSI MASUKKAN KODE BARANG KE TABEL TEMP_BARANG + function insertTemp($kdBrg,$id,$session){ + if(bukaKoneksi()){ + global $conn; + $query = "INSERT INTO temp$session VALUES(?,?)"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'si',$kdBrg,$id); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_affected_rows($stmt); + if($cek > 1){ + return true; + }else{ + return false; + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + tutupKoneksi($conn); + } + } + } + //------------------------------------FUNGSI CEK KODE BARANG DI TABEL TEMP KODE BARANG--------------------------- + function cekTemp($strip,$IDmerk,$kp,$subkat,$bulan,$tahun,$hp,$no,$session){ + if(bukaKoneksi()){ + global $conn; + $kdBrg = $strip.$IDmerk.$kp."%"; + $str = ""; + //cek ke temporary table + $query = "SELECT kode_barang FROM temp$session WHERE kode_barang LIKE ? ORDER BY id_urut DESC LIMIT 1"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'s',$kdBrg); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){//jika ada maka increment no urut nya lalu insert ke tabel temp + mysqli_stmt_bind_result($stmt,$kd_barang); + while(mysqli_stmt_fetch($stmt)){ + $noUrut = substr($kd_barang,6,3); + $index = getIdUrut($noUrut); + $index++; + $noUrut = getNoUrut($index); + $str = substr($kd_barang,0,6).$noUrut; + insertTemp($str,$index,$session); + } + }else{//jika ga ada, cek ke db d_pembelian,jika ketemu diincrement pake fungsi 'getKdBeli', setelah itu masukkan ke tabel temp + if(cekKdBeli($kdBrg)){//jika sudah ada di tabel d_pembelian : + $str = getKdBeli($kdBrg); + $noUrut = substr($str,6,3); + $index = getIdUrut($noUrut);//get index nya + }else{ //jika tdk ada di d_pembelian maka ambil ke db barang melalui fungsi labeling + $str = labeling($strip,$IDmerk,$kp,$subkat,$bulan,$tahun,$hp,$no); + $noUrut = substr($str,6,3); + $index = getIdUrut($noUrut);//get index nya + } + insertTemp($str,$index,$session); + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + tutupKoneksi($conn); + } + return $str; + } + } + //--------------------------------------FUNGSI DROP TABEL TEMP BARANG--------------------------------------- + function hapusTemp($session){ + if(bukaKoneksi()){ + global $conn; + $query = "DROP TABLE temp$session"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_affected_rows($stmt); + if($cek > 0){ + return true; + }else{ + return false; + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + tutupKoneksi($conn); + } + } + } + + //---------------------------------------FUNGSI UNTUK BUAT TABEL TEMP_NAMA_USER-------------------------------------- + function buatTemp($session){ + if(bukaKoneksi()){ + global $conn; + $query = "CREATE TABLE temp$session(kode_barang char(9) primary key,id_urut int(11))"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_affected_rows($stmt); + if($cek > 0){ + return true; + }else{ + return false; + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + } + tutupKoneksi($conn); + } + } + //---------------------------------------FUNGSI HAPUS ISI TEMP_NAMA_USER--------------------------------------- + function truncTemp($session){ + if(bukaKoneksi()){ + global $conn; + $query = "TRUNCATE TABLE temp$session"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_affected_rows($stmt); + if($cek > 0){ + return true; + }else{ + return false; + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + tutupKoneksi($conn); + } + } + } + //---------------------------------------FUNGSI CEK KODE BARANG DI TABEL TEMP ------------------------------------- + function cekBrgTemp($kdBrg,$session){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT kode_barang FROM temp$session WHERE kode_barang = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'s',$kdBrg); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + $query1 = "DELETE FROM temp$session WHERE kode_barang = ?"; + if($stmt1 = mysqli_prepare($conn,$query1)){ + mysqli_stmt_bind_param($stmt1,'s',$kdBrg); + mysqli_stmt_execute($stmt1); + mysqli_stmt_free_result($stmt1); + mysqli_stmt_close($stmt1); + } + } + } + } + } + //---------------------------------------FUNGSI UNTUK HAPUS ISI TABEL TEMP_ORDER------------------------------------- + function hapusTempOrder($noOrder){ + if(bukaKoneksi()){ + global $conn; + $query = "DELETE FROM temp_order WHERE no_order = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'s',$noOrder); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_affected_rows($stmt); + if($cek > 0){ + return true; + }else{ + return false; + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + } + tutupKoneksi($conn); + } + } + //-------------------------------------FUNGSI CEK TEMP ORDER--------------------------------------------------- + function cekTempOrder($noOrder){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT no_order FROM temp_order WHERE no_order = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'s',$noOrder); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + return true; + }else{ + return false; + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + } + tutupKoneksi($conn); + } + } + //------------------------------FUNGSI INSERT NO ORDER KE TEMP ORDER-------------------------------------- + function insertTempOrder($noOrder){ + if(bukaKoneksi()){ + global $conn; + $query = "INSERT INTO temp_order VALUES(?)"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'s',$noOrder); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_affected_rows($stmt); + if($cek > 1){ + return true; + }else{ + return false; + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + tutupKoneksi($conn); + } + } + } + function selectTempOrder(){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT no_order FROM temp_order ORDER BY no_order DESC LIMIT 1"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$noOrder); + while(mysqli_stmt_fetch($stmt)){ + //$no_order = $noOrder; + return $noOrder; + } + + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + tutupKoneksi($conn); + } + } + } + //----------------------------------FUNGSI CEK KODE BARANG DI D_PEMBELIAN--------------------------------------- + function cekKdBeli($kdBrg){ + if(bukaKoneksi()){ + global $conn; + //$query = "SELECT kode_barang FROM d_pembelian WHERE kode_barang LIKE ? ORDER BY kode_barang DESC LIMIT 1"; + $query = "SELECT d.kode_barang + FROM d_pembelian d, nomor_urut n + FORCE INDEX ( urut ) + WHERE n.urut = right( d.kode_barang, 3 ) + AND d.kode_barang LIKE ? + ORDER BY n.id DESC + LIMIT 1"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'s',$kdBrg); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){//berarti sudah ada kode barangnya di dbeli + return true; + }else{ + return false; + } + } + } + } + //---------------------------------FUNGSI GET KODE BARANG TERAKHIR INCREMENT DARI D_BELI-------------------------- + function getKdBeli($kdBrg){ + if(bukaKoneksi()){ + global $conn; + //$query = "SELECT kode_barang FROM d_pembelian WHERE kode_barang LIKE ? ORDER BY kode_barang DESC LIMIT 1"; + $query = "SELECT d.kode_barang + FROM d_pembelian d, nomor_urut n + FORCE INDEX ( urut ) + WHERE n.urut = right( d.kode_barang, 3 ) + AND d.kode_barang LIKE ? + ORDER BY n.id DESC + LIMIT 1"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'s',$kdBrg); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){//berarti sudah ada kode barangnya di dbeli + mysqli_stmt_bind_result($stmt,$kodeBrg); + while(mysqli_stmt_fetch($stmt)){ + $strip = substr($kodeBrg,0,2); + $merk = substr($kodeBrg,2,2); + $kp = substr($kodeBrg,4,1); + $subkat = substr($kodeBrg,5,1); + $noUrut = substr($kodeBrg,6,3);//untuk di increment + $index = getIdUrut($noUrut);//get index nya + $index++;//increment index + $Urut = getNoUrut($index);//get no urut untuk index yang disebut + $str = $strip.$merk.$kp.$subkat.$Urut; + return $str; + } + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + tutupKoneksi($conn); + } + } + } + //------------------------------------------FUNGSI CEK BARANG DI TABEL BARANG------------------------------------- + function cekKdBarang($kdBrg){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT * FROM barang WHERE kode_barang LIKE ? ORDER BY kode_barang DESC LIMIT 1"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'s',$kdBrg); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){//berarti kode barang sudah ada di tabel barang + return true; + }else{ + return false; + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + tutupKoneksi($conn); + } + } + } + + //---------------------------------------------FUNGSI CEK ID GABUNGAN DI NO BARANG------------------------------ + function cekIDNo($id,$nomor){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT * FROM no_barang WHERE id_gabungan = ? AND nomor = ?"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'ss',$id,$nomor); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){//jika sudah ada no dan id gabungan di nomor barang maka + return true; + }else{ + return false; + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + tutupKoneksi($conn); + } + } + } + //---------------------------------------------FUNGSI UNTUK GET BARANG DARI DBELI MASUK KE TEMPUSER-------------- + function loadDBeliTemp($kdBrg,$session){ + if(bukaKoneksi()){ + global $conn; + $query = "SELECT kode_barang FROM d_pembelian WHERE kode_barang LIKE ? ORDER BY kode_barang DESC LIMIT 1"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_bind_param($stmt,'s',$kdBrg); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kodebarang); + while(mysqli_stmt_fetch($stmt)){ + $noUrut = substr($kodebarang,6,3);//untuk di increment + $index = getIdUrut($noUrut);//get index nya + insertTemp($kodebarang,$index,$session); + } + } + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + tutupKoneksi($conn); + } + } + } + + +?> diff --git a/old-source/getTempo.php b/old-source/getTempo.php new file mode 100644 index 0000000..404c49a --- /dev/null +++ b/old-source/getTempo.php @@ -0,0 +1,30 @@ + + 0){ + mysqli_stmt_bind_result($stmt,$lamaTempo); + while(mysqli_stmt_fetch($stmt)){ + echo $lamaTempo; + } + } + } + } +?> \ No newline at end of file diff --git a/old-source/images/calendar.gif b/old-source/images/calendar.gif new file mode 100644 index 0000000..d0abaa7 Binary files /dev/null and b/old-source/images/calendar.gif differ diff --git a/old-source/images/close.gif b/old-source/images/close.gif new file mode 100644 index 0000000..3a91256 Binary files /dev/null and b/old-source/images/close.gif differ diff --git a/old-source/images/delete.png b/old-source/images/delete.png new file mode 100644 index 0000000..cde97da Binary files /dev/null and b/old-source/images/delete.png differ diff --git a/old-source/images/edit.png b/old-source/images/edit.png new file mode 100644 index 0000000..84ae814 Binary files /dev/null and b/old-source/images/edit.png differ diff --git a/old-source/images/load.gif b/old-source/images/load.gif new file mode 100644 index 0000000..c69e937 Binary files /dev/null and b/old-source/images/load.gif differ diff --git a/old-source/images/logo.JPG b/old-source/images/logo.JPG new file mode 100644 index 0000000..14d1562 Binary files /dev/null and b/old-source/images/logo.JPG differ diff --git a/old-source/images/logocleo.jpg b/old-source/images/logocleo.jpg new file mode 100644 index 0000000..14d1562 Binary files /dev/null and b/old-source/images/logocleo.jpg differ diff --git a/old-source/index.php b/old-source/index.php new file mode 100644 index 0000000..52de5aa --- /dev/null +++ b/old-source/index.php @@ -0,0 +1,46 @@ + + + + + Cleopatra + + + + + + + +
+
+
+
+
+
+ + + + +
+ + + + + +
Login Program Cleopatra Minimarket
Username
Password
+
+
+ + + diff --git a/old-source/js/barang.js b/old-source/js/barang.js new file mode 100644 index 0000000..327f45f --- /dev/null +++ b/old-source/js/barang.js @@ -0,0 +1,482 @@ +$(document).ready(function() { + $('#fshasil').invisibleEl(); + $('#fshasilupline').invisibleEl(); + + /* dialog */ + $('#dialogcaribarang').jqm({ + modal: true, + trigger: '#btncaribarang', + overlay: 30, + overlayClass: 'whiteOverlay', + onShow : function(hash){ + hash.w.fadeIn(50); + }, + onHide : function(hash){ + hash.w.fadeOut(50, function(){if(hash.o) hash.o.remove();}); + $('input[name="txtcari"]').val(''); + $('#hasil').empty(); + } + }); + $('#btncaribarang').live('click', function(){ + $('#dialogcaribarang').jqmShow(); + return false; + }); + + // Close Button Highlighting. IE doesn't support :hover. Surprise? + $('input.jqmdX') + .hover( + function(){ $(this).addClass('jqmdXFocus'); }, + function(){ $(this).removeClass('jqmdXFocus'); }) + .focus( + function(){ this.hideFocus=true; $(this).addClass('jqmdXFocus'); }) + .blur( + function(){ $(this).removeClass('jqmdXFocus'); + }); + + //$('input[name="tgllahir"]').datepicker({ + // dateFormat: 'dd-mm-yy', + // changeMonth: true, + // changeYear: true, + // yearRange: '1900:2009', + //}); + + //cek barang form purchase + $('input[name="barcode"]').bind('blur', function(){ + var postvars = { + barcode : $("input[name='barcode']").val(), + operation: "cekbarang", + status: "ok" + }; + if ($("input[name='barcode']").val() != "") { + $.post('ajaxbarang.php', postvars, function(data) { + var barang = eval('('+data+')'); + if (barang[0] == 0) { + alert('Barang belum terdaftar,silahkan entry barang terlebih dahulu!'); + }else{ + for(i in barang) { + setNilaiPurchase(barang[i].kode_barang); + } + } + }); + } + }); + + //cek faktur + $('input[name="nofaktur"]').bind('blur', function(){ + var postvars = { + nofaktur : $("input[name='nofaktur']").val(), + operation: "cekfaktur", + status: "ok" + }; + if ($("input[name='nofaktur']").val() != "") { + $.post('ajaxbarang.php', postvars, function(data) { + var hasil = eval('('+data+')'); + if (hasil[0] == 1) { + alert('PERHATIAN,NO.FAKTUR SUDAH ADA!'); + }else{ + alert('No.faktur belum terdaftar,silahkan dilanjut..'); + } + }); + } + }); + + // ambil data + $('form[name="fcaribarang"]').submit(function(){ + var postvars = { + txtcari: $("input[name='txtcari']").val(), + operation: "caribarang", + status: "ok" + }; + $.post('ajaxbarang.php', postvars, function(data) { + var barang = eval('('+data+')'); + var hasil;//[barang.length]; + var tabel = ""; + tabel += ""; + for(i in barang) { + tabel += ""; + tabel += ""; + tabel += ""; + tabel += ""; + } + tabel += "
KodeBarcodeNamaSupplierHapus
"+barang[i].kode_barang+"" + barang[i].barcode + "" + barang[i].nama_barang + "" + barang[i].nama_supplier + " HAPUS
"; + $("#hasil").html(tabel); + $('#fshasil').visibleEl(); + }); + return false; + }); + + // ambil data purchase + $('form[name="fcaribarangpurchase"]').submit(function(){ + var postvars = { + txtcaripurchase: $("input[name='txtcaripurchase']").val(), + operation: "caribarangpurchase", + status: "ok" + }; + $.post('ajaxbarang.php', postvars, function(data) { + var barang = eval('('+data+')'); + var hasil;//[barang.length]; + var tabel = ""; + tabel += ""; + for(i in barang) { + tabel += ""; + tabel += ""; + tabel += ""; + tabel += ""; + } + tabel += "
KodeBarcodeNamaSupplierHapus
"+barang[i].kode_barang+"" + barang[i].barcode + "" + barang[i].nama_barang + "" + barang[i].nama_supplier + " HAPUS
"; + $("#hasil").html(tabel); + $('#fshasil').visibleEl(); + }); + return false; + }); + + // simpan barang + $('input[name="btnsubmit"]').click(function(){ + var postvars = $('form[name="barang"]').formToArray(); + $.post('ajaxbarang.php', postvars, function(data) { + var hasil = eval('('+data+')'); + if (hasil[0] == 1) { + alert("Simpan Data berhasil!"); + $('form[name="barang"]').resetForm(); + ambilKodeBarang(); + } else if (hasil[0] == 2) { + alert("Ada data yang kosong!"); + } else { + alert("Update data berhasil"); + } + }); + return false; + }); + + // tambah barang ke temp pembelian + $('input[name="btntambah"]').click(function(){ + var postvars = $('form[name="barang"]').formToArray(); + $.post('ajaxtmpbeli.php', postvars, function(data) { + var hasil = eval('('+data+')'); + if (hasil[0] == 1) { + refreshDetilBeli(); + } else if (hasil[0] == 2) { + alert("Ada data yang kosong!"); + } + }); + return false; + }); + + // edit barang di temp pembelian + $('input[name="btnedit"]').click(function(){ + var postvars = $('form[name="barang"]').formToArray(); + $.post('ajaxedittmpbeli.php', postvars, function(data) { + var hasil = eval('('+data+')'); + if (hasil[0] == 1) { + refreshDetilBeli(); + } else if (hasil[0] == 2) { + alert("Ada data yang kosong!"); + } + }); + return false; + }); + + // tambah ke pembelian + $('input[name="btnsubmitpurchase"]').click(function(){ + var postvars = $('form[name="barang"]').formToArray(); + $.post('ajaxpurchase.php', postvars, function(data) { + var hasil = eval('('+data+')'); + if (hasil[0] == 1) { + alert("Faktur pembelian berhasil disimpan."); + window.location = 'purchase.php'; + } else if (hasil[0] == 2) { + alert("Ada data yang kosong!"); + } + }); + return false; + }); + + $('#tglNota').bind('change', function(){ + var postvars = {supp : $('#supp').val()}; + $.post('getTempo.php',postvars,function(data){ + var tglMsk = $('#tglNota').val(); + var tahun = tglMsk.substr(6,4); + var bulan = tglMsk.substr(3,2); + var tgl = tglMsk.substr(0,2); + //var date = tgl+"/"+bulan+"/"+tahun; + bulan = parseInt(bulan,10)-1; + tahun = parseInt(tahun,10); + tgl = parseInt(tgl,10); + var Detnya = new Date(tahun,bulan,tgl);//convert to date + //Detnya.add("day",data); + + function addDays(myDate,days) { + return new Date(myDate.getTime() + days*24*60*60*1000); + } + tglJthTmp = addDays(Detnya,data); + //alert (tglJthTmp); + + tglJthTmp = tglJthTmp.toString(); + var blnB = tglJthTmp.substr(4,3); + var tglB = tglJthTmp.substr(8,2); + var thnB = tglJthTmp.substr(11,4); + switch(blnB){ + case "Jan" : blnB = "01";break; + case "Feb" : blnB = "02";break; + case "Mar" : blnB = "03";break; + case "Apr" : blnB = "04";break; + case "May" : blnB = "05";break; + case "Jun" : blnB = "06";break; + case "Jul" : blnB = "07";break; + case "Aug" : blnB = "08";break; + case "Sep" : blnB = "09";break; + case "Oct" : blnB = "10";break; + case "Nov" : blnB = "11";break; + case "Dec" : blnB = "12";break; + } + var dateB = tglB+"-"+blnB+"-"+thnB; + $('#tglJthTmp').val(dateB); + document.getElementById("status").focus(); + }); + }); + +}); // end of document ready + +function setNilai(barang) { + var postvars = {id_barang: barang, + operation: 'ambilbarang', + status: 'ok' + }; + $.post('ajaxbarang.php', postvars, function(data){ + var barang = eval('('+data+')'); + $('input[name="kodebarang"]').val(barang[0].kode_barang); + $('input[name="barcode"]').val(barang[0].barcode); + $('input[name="nama"]').val(barang[0].nama_barang); + $('input[name="supp"]').val(barang[0].kode_supplier); + if(barang[0].kode_strip == ""){ + $('select[name="group"] option[value="-"]').attr("selected", "selected"); + } else{ + $('select[name="group"] option[value="'+barang[0].kode_strip+'"]').attr("selected", "selected"); + } + if(barang[0].ked_produk != ""){ + $("#lininya").show(); + $('input[name="kode_dlmpdk"]').val(barang[0].ked_produk); + $('input[name="radiolini"]').val(barang[0].namakedproduk); + } + $('input[name="hp"]').val(barang[0].harga_pokok); + $('input[name="hj"]').val(barang[0].harga_jual); + $('input[name="isi2"]').val(barang[0].isi_max2); + $('input[name="hj2"]').val(barang[0].harga_jual2); + $('input[name="isi3"]').val(barang[0].isi_max3); + $('input[name="hj3"]').val(barang[0].harga_jual3); + if(barang[0].satuan == ""){ + $('select[name="satuan"] option[value="-"]').attr("selected", "selected"); + } else{ + $('select[name="satuan"] option[value="'+barang[0].satuan+'"]').attr("selected", "selected"); + } + $('input[name="stokbrg"]').val(barang[0].stokbrg); + $('#dialogcaribarang').jqmHide(); + }); +} + +function setNilaiPurchase(barang) { + var postvars = {id_barang: barang, + operation: 'ambilbarang', + status: 'ok' + }; + $.post('ajaxbarang.php', postvars, function(data){ + var barang = eval('('+data+')'); + $('input[name="kodebarang"]').val(barang[0].kode_barang); + $('input[name="barcode"]').val(barang[0].barcode); + $('input[name="nama"]').val(barang[0].nama_barang); + $('input[name="supp"]').val(barang[0].kode_supplier); + $('select[name="group"]').val(barang[0].nama_strip); + $('input[name="group"]').val(barang[0].nama_strip); + if(barang[0].ked_produk != ""){ + $("#lininya").show(); + $('input[name="radiolini"]').val(barang[0].namakedproduk); + } + $('input[name="subgroup"]').val(barang[0].namakedproduk); + $('input[name="hp"]').val(barang[0].harga_pokok); + $('input[name="hj"]').val(barang[0].harga_jual); + $('input[name="isi2"]').val(barang[0].isi_max2); + $('input[name="hj2"]').val(barang[0].harga_jual2); + $('input[name="isi3"]').val(barang[0].isi_max3); + $('input[name="hj3"]').val(barang[0].harga_jual3); + $('input[name="satuan"]').val(barang[0].namaSatuanBarang); + $('select[name="satuan"]').val(barang[0].namaSatuanBarang); + $('input[name="stokbrg"]').val(barang[0].stokbrg); + $('#dialogcaribarang').jqmHide(); + document.forms["barang"].jmlbeli.focus(); + }); +} + +function setDelete(barang) { + var postvars = {id_barang: barang, + operation: 'hapusbarang', + status: 'ok' + }; + var answer = confirm ("Yakin hapus data?") + if (answer) + $.post('ajaxbarang.php', postvars, function(data){ + var kary = eval('('+data+')'); + if(kary[0] == 1){ + alert("Hapus Berhasil"); + $('#dialogcaribarang').jqmHide(); + $('form[name="barang"]').resetForm(); + } else { + alert("Hapus Gagal"); + } + }); +} + +function setDeleteBeli(idbeli) { + var postvars = {id_barang: idbeli, + operation: 'hapusbeli', + status: 'ok' + }; + var answer = confirm ("Yakin hapus data?") + if (answer) + $.post('ajaxbarang.php', postvars, function(data){ + var tbeli = eval('('+data+')'); + if(tbeli[0] == 1){ + alert("Hapus Berhasil"); + refreshDetilBeli(); + } else { + alert("Hapus Gagal"); + } + }); +} + +function setEditBeli(idbeli) { + var postvars = {id_barang: idbeli, + operation: 'editbeli', + status: 'ok' + }; + $.post('ajaxbarang.php', postvars, function(data){ + var tbeli = eval('('+data+')'); + setNilaiPurchase(tbeli[0].kode_barang); + $('#jmlbeli').val(tbeli[0].jumlah); + $('#subtotal').val(tbeli[0].subtotal); + $('#disc').val(tbeli[0].disc); + $('#discrp').val(tbeli[0].discrp); + $('#ppn').val(tbeli[0].ppn); + $('#profit').val(tbeli[0].profit); + $('#hpbaru').val(tbeli[0].harga_pokok); + $('#hjbaru').val(tbeli[0].harga_jual); + $('#expdate').val(tbeli[0].exp); + $('#idTemp').val(tbeli[0].id); + + }); + +} + +function ambilKodeBarang() { + var postvars = { operation: 'ambilKode', status: 'ok'}; + $.post('ajaxbarang.php', postvars, function(data){ + var kdBarang = eval('('+data+')'); + $('input[name="kodebarang"]').val(kdBarang); + }); +} + +function getHP(){ + var jml = $('#jmlbeli').val(); + var subtbeli = $('#subtotal').val(); + var disc = $('#disc').val(); + var discrp = $('#discrp').val(); + var ppn = $('#ppn').val(); + + jml = parseInt(jml,10); + subtbeli = parseInt(subtbeli,10); + disc = parseInt(disc,10); + discrp = parseInt(discrp,10); + ppn = parseInt(ppn,10); + + HrgP = Math.round(subtbeli/jml); + A = HrgP - (HrgP*disc/100); //hrg pokok stlh disc + B = A - discrp; //hrg pokok stlh disc dan disc rupiah + C = B + (B*ppn/100); //hrg pokok stlh disc dan disc rupiah dan PPn + newHrgP = Math.round(C); + return newHrgP; + +} +function getHJ(){ + var newHP = getHP(); + var profit = $('#profit').val(); + + profit = parseInt(profit,10); + newHrgJ = newHP + (newHP*profit/100); + newHrgJ = Math.round(newHrgJ); + return newHrgJ; +} + +function getHrgNew(){ + var newHP = getHP(); + var newHJ = getHJ(); + + $('input[name="hpbaru"]').val(newHP); + $('input[name="hjbaru"]').val(newHJ); + +} + +function hitProfit(){ + var hp = $('#hp').val(); + var profit = $('#profit').val(); + + hp = parseInt(hp,10); + profit = parseInt(profit,10); + hj = hp + (hp*profit/100); + newhj = Math.round(hj); + $('input[name="hj"]').val(newhj); +} + +function getRpNett(){ + var trpbeli = $('#trBeli').val(); + var disc = $('#discProNota').val(); + var discrp = $('#discNota').val(); + var ppn = $('#ppnNota').val(); + + trpbeli = parseInt(trpbeli,10); + disc = parseInt(disc,10); + discrp = parseInt(discrp,10); + ppn = parseInt(ppn,10); + + A = trpbeli - (trpbeli*disc/100); //hrg beli stlh disc + B = A - discrp; //hrg beli stlh disc dan disc rupiah + C = B + (B*ppn/100); //hrg beli stlh disc dan disc rupiah dan PPn + newHrgNett = Math.round(C); + + $('input[name="trBeliNett"]').val(newHrgNett); +} + +function clearChildren(element) { + for (var i = 0; i < element.childNodes.length; i++) { + var e = element.childNodes[i]; + if (e.tagName) switch (e.tagName.toLowerCase()) { + case 'input': + switch (e.type) { + case "radio": + case "checkbox": e.checked = false; break; + case "button": + case "submit": + case "image": break; + default: e.value = ''; break; + } + break; + case 'select': e.selectedIndex = 0; break; + case 'textarea': e.innerHTML = ''; break; + default: clearChildren(e); + } + } +} + +function refreshDetilBeli(){ + var nol = 0; + var main = "viewtmpbeli.php"; + $("#tmpbeli").load(main); + clearChildren(document.getElementById('detilbeli')); + + $('input[name="disc"]').val(nol); + $('input[name="discrp"]').val(nol); + $('input[name="ppn"]').val(nol); + $('input[name="profit"]').val(nol); + $('input[name="hpbaru"]').val(nol); + $('input[name="hjbaru"]').val(nol); + document.forms["barang"].barcode.focus(); + +} diff --git a/old-source/js/barcoding.js b/old-source/js/barcoding.js new file mode 100644 index 0000000..e75309c --- /dev/null +++ b/old-source/js/barcoding.js @@ -0,0 +1,224 @@ +$().ready(function() { + /** + * plug in button operation(disabled and enabled) + * by Daniel Susanto - susantodaniel@gmail.com + */ + jQuery.fn.disabledBtn = function() { + if(this != null){ + if(this.attr('disabled') == false) + this.attr('disabled', true); + } + } + + jQuery.fn.enabledBtn = function() { + if(this != null){ + if(this.attr('disabled') == true) + this.attr('disabled', false); + } + } + + $('#alert').dialog({ + modal:true, + autoOpen: false, + width: 250, + height: 70, + overlay: { + opacity: 0.5, + background: "black" + }, + buttons: { + "Ok": function() { + $(this).dialog("close"); + } + } + }); +}); + +/* + * alert function + * @param String msg message to be displayed + */ +function alert(msg) +{ + $('p#alertmsg').text(msg); + $('#alert').dialog('open'); +} + +/** + * Mode untuk nomor faktur + */ +function fakturMode() +{ + // enable textbox nomor faktur dan btn car, set focus ke textbox no faktur; + document.forms["frmlabeling"].nofaktur.disabled = false; + document.forms["frmlabeling"].btncarib.disabled = true; + document.forms["frmlabeling"].btncarin.disabled = false; + document.forms["frmlabeling"].nofaktur.focus(); + // disable textbox untuk kode barang dan jumlah barang + document.forms["frmlabeling"].kkodebarang.value = ""; + document.forms["frmlabeling"].knomorbarang.value = ""; + document.forms["frmlabeling"].kjml.value = ""; + document.forms["frmlabeling"].kkodebarang.disabled = true; + document.forms["frmlabeling"].knomorbarang.disabled = true; + document.forms["frmlabeling"].kjml.disabled = true; +} + +/** + * Mode untuk kode barang + */ +function kodeMode() +{ + // enable textbox kode barang dan jml barang, set focus ke textbox kode barang; + document.forms["frmlabeling"].kkodebarang.disabled = false; + document.forms["frmlabeling"].knomorbarang.disabled = false; + document.forms["frmlabeling"].kjml.disabled = false; + //document.forms["frmlabeling"].kkodebarang.focus(); + // disable textbox untuk no faktur dan btn cari + document.forms["frmlabeling"].nofaktur.value = ""; + document.forms["frmlabeling"].nofaktur.disabled = true; + document.forms["frmlabeling"].btncarin.disabled = true; + document.forms["frmlabeling"].btncarib.disabled = false; +} + +/** + * Proses inputan barcode + */ +function prosesBarcode() +{ + // jika sumber data dari kode barang tertentu + if(document.forms["frmlabeling"].kkodebarang.disabled == false && document.forms["frmlabeling"].nofaktur.disabled == true) + { + var jumlahCetak = parseInt(document.forms["frmlabeling"].kjml.value); + jumlahCetak = isNaN(jumlahCetak) ? 0 : jumlahCetak; + // jika kode barang atau jumlah cetak tidak diisi + if(document.forms["frmlabeling"].kkodebarang.value == "" || document.forms["frmlabeling"].kjml.value == "" || jumlahCetak == 0) + alert("Data Tidak Valid !."); + + else + { + $(function(){ + var dt = ""; + var gvar = $("#kkodebarang").val(); + var gvar2 = $("#knomorbarang").val(); + $.get("barcode_kbarang.php?kode=" + gvar + "&nomor=" + gvar2, function(data){ + var nota = eval('('+data+')'); + for(i in nota) { + dt += "" + + ""; + jum++; + } + $("#dbayangan").empty(); + $("#dbayangan").append(dt); + document.forms["frmlabeling"].submit(); + var postvar = {sesi : 6} + $.post('../log.php',postvar, function(data){ + alert(data); + }); + }); + }); + } + } + // jika sumber data dari nomor faktur + else if(document.forms["frmlabeling"].nofaktur.disabled == false && document.forms["frmlabeling"].kkodebarang.disabled == true) + { + // jika nomor faktur masih kosong + if(document.forms["frmlabeling"].nofaktur.value == "") + alert("Data Tidak Valid !."); + else + { + var nofak = document.forms["frmlabeling"].nofaktur.value; + var postvars = {nota:nofak}; + var dt = ""; + var jum = 0; + $(function(){ + $.post('barcode_nota.php', postvars, function(data){ + var nota = eval('('+data+')'); + for(i in nota) { + dt += "" + + "" + + "" + + "" + + ""; + jum++; + } + dt += ""; + $("#dbayangan").empty(); + $("#dbayangan").append(dt); + document.forms["frmlabeling"].submit(); + }); + }); + } + } +} + +function printlabel() +{ + // jika sumber data dari kode barang tertentu + if(document.forms["frmlabeling"].kkodebarang.disabled == false && document.forms["frmlabeling"].nofaktur.disabled == true) + { + var jumlahCetak = parseInt(document.forms["frmlabeling"].kjml.value); + jumlahCetak = isNaN(jumlahCetak) ? 0 : jumlahCetak; + // jika kode barang atau jumlah cetak tidak diisi + if(document.forms["frmlabeling"].kkodebarang.value == "" || document.forms["frmlabeling"].kjml.value == "" || jumlahCetak == 0) + alert("Data Tidak Valid !"); + + else + { + $(function(){ + var dta = ""; + var jvar = $("#kkodebarang").val(); + var jvar2 = $("#knomorbarang").val(); + var jvar3 = $("#kjml").val(); + $.get("barcode_kbarang.php?kode=" + jvar + "&nomor=" + jvar2, function(data){ + var nota2 = eval('('+data+')'); + for(i in nota2) { + dta += "" + + "" + + "" + + "" + + ""; + jum++; + } + $("#dbayangan2").empty(); + $("#dbayangan2").append(dta); + document.forms["frmlabeling2"].submit(); + var postvar = {sesi : 6} + $.post('../log.php',postvar, function(data){ + alert(data); + }); + }); + }); + } + } + // jika sumber data dari nomor faktur + else if(document.forms["frmlabeling"].nofaktur.disabled == false && document.forms["frmlabeling"].kkodebarang.disabled == true) + { + // jika nomor faktur masih kosong + if(document.forms["frmlabeling"].nofaktur.value == "") + alert("Data Tidak Valid !."); + else + { + var nofak = document.forms["frmlabeling"].nofaktur.value; + var postvars = {nota:nofak}; + var dta = ""; + var jum = 0; + $(function(){ + $.post('barcode_nota.php', postvars, function(data){ + var nota2 = eval('('+data+')'); + for(i in nota2) { + dta += "" + + "" + + "" + + "" + + ""; + jum++; + } + dta += ""; + $("#dbayangan2").empty(); + $("#dbayangan2").append(dta); + document.forms["frmlabeling2"].submit(); + }); + }); + } + } +} diff --git a/old-source/js/dlmpdk.js b/old-source/js/dlmpdk.js new file mode 100644 index 0000000..9c207f0 --- /dev/null +++ b/old-source/js/dlmpdk.js @@ -0,0 +1,106 @@ +// JavaScript Document +$(document).ready(function() { + $('#fshasil').invisibleEl(); + /* dialog */ + $('#dialogcaridlmpdk').jqm({ + modal: true, + trigger: '#btncarinama', + overlay: 30, + overlayClass: 'whiteOverlay', + onShow : function(hash){ + hash.w.fadeIn(50); + }, + onHide : function(hash){ + hash.w.fadeOut(50, function(){if(hash.o) hash.o.remove();}); + $('input[name="txtcari"]').val(''); + $('#hasil').empty(); + } + }); + + $('#btncarinama').live('click', function(){ + $('#dialogcaridlmpdk').jqmShow(); + return false; + }); + + // Close Button Highlighting. IE doesn't support :hover. Surprise? + $('input.jqmdX') + .hover( + function(){ $(this).addClass('jqmdXFocus'); }, + function(){ $(this).removeClass('jqmdXFocus'); }) + .focus( + function(){ this.hideFocus=true; $(this).addClass('jqmdXFocus'); }) + .blur( + function(){ $(this).removeClass('jqmdXFocus'); }); + + // ambil data + $('form[name="fcaridlmpdk"]').submit(function(){ + var postvars = { + txtcari: $("input[name='txtcari']").val(), + operation: "caridlmpdk", + status: "ok" + }; + $.post('ajaxdlmpdk.php', postvars, function(data) { + var dlmpdk = eval('('+data+')'); + var hasil; + var tabel = ""; + tabel += ""; + tabel += ""; + for(i in dlmpdk) { + tabel += ""; + tabel += " "; + } + tabel += "
Sub Group ProductGroup ProductNamaHapus
"+dlmpdk[i].kode_ked_produk+" " + dlmpdk[i].kode_strip + " " + dlmpdk[i].ked_produk + " HAPUS
"; + $("#hasil").html(tabel); + $('#fshasil').visibleEl(); + }); + return false; + }); + + // simpan dlmpdk + $('form[name="fdlmpdk"]').submit(function(){ + var postvars = $('form[name="fdlmpdk"]').formToArray(); + $.post('ajaxdlmpdk.php', postvars, function(data) { + var hasil = eval('('+data+')'); + if(hasil[0] == 1){ + alert("Berhasil"); + $('form[name="fdlmpdk"]').resetForm(); + } else { + alert("Gagal"); + } + }); + return false; + }); +}); + +function setNilai(dlmpdk) { + var postvars = {id_dlmpdk: dlmpdk, + operation: 'ambildlmpdk', + status: 'ok' + }; + $.post('ajaxdlmpdk.php', postvars, function(data){ + var dlmpdk = eval('('+data+')'); + $('input[name="kodedlmpdk"]').val(dlmpdk[0].kode_ked_produk); + $('input[name="lini"]').val(dlmpdk[0].kode_strip); + $('input[name="nama"]').val(dlmpdk[0].ked_produk); + $('#dialogcaridlmpdk').jqmHide(); + }); +} + +function setDelete(dlmpdk) { + var postvars = {id_dlmpdk: dlmpdk, + operation: 'hapusdlmpdk', + status: 'ok' + }; + var answer = confirm ("Yakin hapus data?") + if (answer) + $.post('ajaxdlmpdk.php', postvars, function(data){ + var kary = eval('('+data+')'); + if(kary[0] == 1){ + alert("Hapus Berhasil"); + $('#dialogcaridlmpdk').jqmHide(); + $('form[name="fdlmpdk"]').resetForm(); + } else { + alert("Hapus Gagal"); + } + }); +} diff --git a/old-source/js/jqModal.js b/old-source/js/jqModal.js new file mode 100644 index 0000000..3aac816 --- /dev/null +++ b/old-source/js/jqModal.js @@ -0,0 +1,69 @@ +/* + * jqModal - Minimalist Modaling with jQuery + * (http://dev.iceburg.net/jquery/jqModal/) + * + * Copyright (c) 2007,2008 Brice Burgess + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * $Version: 03/01/2009 +r14 + */ +(function($) { +$.fn.jqm=function(o){ +var p={ +overlay: 50, +overlayClass: 'jqmOverlay', +closeClass: 'jqmClose', +trigger: '.jqModal', +ajax: F, +ajaxText: '', +target: F, +modal: F, +toTop: F, +onShow: F, +onHide: F, +onLoad: F +}; +return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s; +H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s}; +if(p.trigger)$(this).jqmAddTrigger(p.trigger); +});}; + +$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');}; +$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');}; +$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t);});}; +$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});}; + +$.jqm = { +hash:{}, +open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('
').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z); + if(c.modal) {if(!A[0])L('bind');A.push(s);} + else if(c.overlay > 0)h.w.jqmAddClose(o); + else o=F; + + h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F; + if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}} + + if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u; + r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});} + else if(cc)h.w.jqmAddClose($(cc,h.w)); + + if(c.toTop&&h.o)h.w.before('').insertAfter(h.o); + (c.onShow)?c.onShow(h):h.w.show();e(h);return F; +}, +close:function(s){var h=H[s];if(!h.a)return F;h.a=F; + if(A[0]){A.pop();if(!A[0])L('unbind');} + if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove(); + if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F; +}, +params:{}}; +var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false, +i=$('').css({opacity:0}), +e=function(h){if(ie6)if(h.o)h.o.html('

').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);}, +f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}}, +L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);}, +m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;}, +hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() { + if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});}; +})(jQuery); \ No newline at end of file diff --git a/old-source/js/jqSajax.class.php b/old-source/js/jqSajax.class.php new file mode 100644 index 0000000..5062f82 --- /dev/null +++ b/old-source/js/jqSajax.class.php @@ -0,0 +1,313 @@ +as_method=0;$this->as_jquery_plugin=0;} + if($jq==1){$this->as_jquery_plugin=1;$this->as_method=0;} + if($jq==2){$this->as_method=1;$this->as_jquery_plugin=0;} + $this->asincronous=$asc; + $this->use_json=$json; + //if($this->as_jquery_plugin)$this->as_method=0; + } + + function getUri($uri='') { + if($uri=='')$uri=$_SERVER["REQUEST_URI"]; + return $uri; + } + + function checkJson(){ + if(function_exists('json_encode') && $this->use_json)return true; + else return false; + } + + function getJsRepr($value) { + $value=serialize($value); + // Escapes a string so it can be safely echo'ed out as Javascript + $value = str_replace(array('\\', "'"), array("\\\\", "\\'"), $value); + $value = preg_replace('#([\x00-\x1F])#e', '"\x" . sprintf("%02x", ord("\1"))', $value); + $value = "'$value'"; + return $value; + } + + function processClientReq() { + $mode = ""; + $obj=isset($_REQUEST['rsobj'])?$_REQUEST['rsobj']:''; + + if (! empty($_GET["rs"])) + $mode = "get"; + + if (!empty($_POST["rs"])) + $mode = "post"; + + if (empty($mode)) + return; + + $target = ""; + + if ($mode == "get") { + // Bust cache in the head + header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past + header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); + // always modified + header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 + header ("Pragma: no-cache"); // HTTP/1.0 + $func_name = $_GET["rs"]; + if (! empty($_GET["rsargs"])) + $args = $_GET["rsargs"]; + else + $args = array(); + } + else { + $func_name = $_POST["rs"]; + if (! empty($_POST["rsargs"])) + $args = $_POST["rsargs"]; + else + $args = array(); + } + if($obj!='')$fname=$obj.'->'.$func_name; + else $fname=$func_name; + if (! in_array($fname, $this->export_list)) + echo "-:$func_name not callable"; + else { + if(!$this->checkJson())echo "+:"; + //for PHP 5 + foreach($args as $key=>$value)$args[$key]=str_replace(array("\\\"", "\\'"), array('"', "'"), $value); + if($obj=='')$result = call_user_func_array($func_name, $args); + else{ + eval("global \$$obj;"); + foreach($args as $key=>$value)$arg[$key]='\''.$value.'\''; + if(isset($arg))$arg2=implode(',',$arg); + else $arg2=NULL; + eval("\$result=\$$fname($arg2);"); + } + //echo "var res = " . trim($this->getJsValue($result)) . "; res;"; + if(!$this->checkJson())echo "var res = " . trim($this->getJsRepr($result)) . "; res;"; + else { + if(is_string($result))echo json_encode('"'.addslashes($result).'"'); + else echo json_encode($result); + //see http://www.json.org/js.html for better solution + } + //because we use php serialize/unserialize http://www.coolcode.cn/?p=171 + //echo "var res = '" . trim(sajax_esc($result)) . "'; res;"; + } + exit; + } + + function getCommonJs() { + $t = strtoupper($this->request_type); + if ($t != "" && $t != "GET" && $t != "POST") + return "// Invalid type: $t.. \n\n"; + + ob_start(); + ?> + + var jqSajax = { + debug_mode : debug_mode ? "true" : "false"; ?>,request_type : "", + target_id : target_id.'\''; ?>,failure_redirect : "failure_redirect; ?>", + friendly_url : friendly_url ? "true" : "false"; ?>,requests: new Array(),data_return:"", + + debug:function(text) {if (this.debug_mode)alert(text);}, + cancel: function() {for (var i = 0; i < this.requests.length; i++)this.requests[i].abort();}, + + serialize:function(inp){ + var getType=function(inp){var type=typeof inp,match;if(type=='object'&&!inp){return'null'}if(type=="object"){if(!inp.constructor){return'object'}var cons=inp.constructor.toString();if(match=cons.match(/(\w+)\(/)){cons=match[1].toLowerCase()}var types=["boolean","number","string","array"];for(key in types){if(cons==types[key]){type=types[key];break}}}return type};var type=getType(inp);var val;switch(type){case"undefined":val="N";break;case"boolean":val="b:"+(inp?"1":"0");break;case"number":val=(Math.round(inp)==inp?"i":"d")+":"+inp;break;case"string":val="s:"+inp.length+":\""+inp+"\"";break;case"array":val="a";case"object":if(type=="object"){var objname=inp.constructor.toString().match(/(\w+)\(\)/);if(objname==undefined){return}objname[1]=this.serialize(objname[1]);val="O"+objname[1].substring(1,objname[1].length-1)}var count=0;var vals="";var okey;for(key in inp){okey=(key.match(/^[0-9]+$/)?parseInt(key):key);vals+=this.serialize(okey)+this.serialize(inp[key]);count++}val+=":"+count+":{"+vals+"}";break}if(type!="object"&&type!="array")val+=";";return val; + }, + unserialize:function(inp){ + error=0;if(inp==""||inp.length<2){errormsg="";return}var val,kret,vret,cval;var type=inp.charAt(0);var cont=inp.substring(2);var size=0,divpos=0,endcont=0,rest="",next="";switch(type){case"N":if(inp.charAt(1)!=";"){errormsg=""}rest=cont;break;case"b":if(!/[01];/.test(cont.substring(0,2))){errormsg=""}val=(cont.charAt(0)=="1");rest=cont.substring(2);break;case"s":val="";divpos=cont.indexOf(":");if(divpos==-1){errormsg="";break}size=parseInt(cont.substring(0,divpos));if(size==0){if(cont.length-divpos<4){errormsg="";break}rest=cont.substring(divpos+4);break}if((cont.length-divpos-size)<4){errormsg="";break}if(cont.substring(divpos+2+size,divpos+4+size)!="\";"){errormsg=""}val=cont.substring(divpos+2,divpos+2+size);rest=cont.substring(divpos+4+size);break;case"i":case"d":var dotfound=0;for(var i=0;iasincronous){ + if($this->checkJson()) echo 'jqSajax.data_return=eval(text);'; + else echo 'jqSajax.data_return=text;'; + } + else { + if($this->checkJson()) echo 'var data==eval(text);'; + else echo 'var data=jqSajax.fhasilc(text);'; + echo 'alert(\'Type: \'+typeof data +\', data:\'+data);'; + } + ?> + }, + as_method)echo $this->getCommonMethod(); ?> + do_call:function(func_name, args, obj) { + var i,post_data,target_id,uri; + this.debug("in jqSajax.do_call()...\nRequest Type: " + this.request_type + "\nTarget Id: " + this.target_id); + target_id = this.target_id; + if (typeof(this.request_type) == "undefined" || this.request_type == "")this.request_type = "GET"; + uri = "getUri(); ?>"; + if (this.request_type == "GET") { + if (uri.indexOf("?") == -1 && this.friendly_url==false)uri += "?rs=" + escape(func_name); + else uri += "&rs=" + escape(func_name); + uri += "&rst=" + escape(target_id); + uri += "&rsrnd=" + new Date().getTime(); + uri += "&rsobj=" + obj; + for (i = 0; i < args.length; i++)uri += "&rsargs[]=" + escape(args[i]); + post_data = null; + } + else if (this.request_type == "POST") { + post_data = "rs=" + escape(func_name); + post_data += "&rst=" + escape(this.target_id); + post_data += "&rsrnd=" + new Date().getTime(); + post_data += "&rsobj=" + obj; + for (i = 0; i < args.length; i++)post_data = post_data + "&rsargs[]=" + escape(args[i]); + } + else this.debug("Illegal request type: " + this.request_type); + + this.debug("Do requested page with JQUERY ajax..."); + this.debug("URI: "+uri); + this.debug("Post Data: "+post_data); + $.ajax({ + async:false, + type: this.request_type, + url : uri, + data: post_data, + checkJson()) echo "dataType:\"json\",\n";?> + success:this.fhasil + }); + } + }; + + getCommonJs(); + } + + function getOneStub($func_name,$obj='') { + ob_start(); + if($obj!='')$pobj=$obj.'_'; + else $pobj=''; + ?> + function x_(){jqSajax.do_call("",x_.arguments,"");asincronous)if($this->checkJson()) echo 'return jqSajax.data_return';else echo 'return jqSajax.fhasilc(jqSajax.data_return)';?>} + + x_:function(){this.do_call("",this.x_.arguments,"");asincronous)if($this->checkJson()) echo 'return jqSajax.data_return';else echo 'return jqSajax.fhasilc(jqSajax.data_return)';?>}, + + $.x_=function(){jqSajax.do_call("",$.x_.arguments,"");asincronous)if($this->checkJson()) echo 'return jqSajax.data_return';else echo 'return jqSajax.fhasilc(jqSajax.data_return)';?>}; + export_list[] = func_get_arg($i); + } + } + + function exportObj() { + $n = func_num_args(); + for ($i = 0; $i < $n; $i++) { + $name=func_get_arg($i); + eval("global \$$name;"); + eval("\$method=get_class_methods(\$$name);"); + foreach($method as $value)$this->export_list[] = $name.'->'.$value; + } + } + + function getCommonMethod() + { + $html = ""; + foreach ($this->export_list as $func) { + $dt=explode('->',$func); + if(!isset($dt[1]))$html .= $this->getOneMethod($dt[0]); + else $html .= $this->getOneMethod($dt[1],$dt[0]); + } + return $html; + } + + function getJs() + { + $html = ""; + if($this->as_jquery_plugin)$this->as_method=0; + if($this->as_method)$html .= $this->getCommonJs(); + else{ + if (! $this->js_has_been_shown) { + $html .= $this->getCommonJs(); + $this->js_has_been_shown = 1; + } + foreach ($this->export_list as $func) { + $dt=explode('->',$func); + if($this->as_jquery_plugin){ + if(!isset($dt[1]))$html .= $this->getOneJquery($dt[0]); + else $html .= $this->getOneJquery($dt[1],$dt[0]); + } + if(!$this->as_jquery_plugin && !$this->as_method){ + if(!isset($dt[1]))$html .= $this->getOneStub($dt[0]); + else $html .= $this->getOneStub($dt[1],$dt[0]); + } + } + } + return $html; + } + + function showJs() + { + echo $this->getJs(); + } +} +?> diff --git a/old-source/js/jquery-1.2.6.js b/old-source/js/jquery-1.2.6.js new file mode 100644 index 0000000..88e661e --- /dev/null +++ b/old-source/js/jquery-1.2.6.js @@ -0,0 +1,3549 @@ +(function(){ +/* + * jQuery 1.2.6 - New Wave Javascript + * + * Copyright (c) 2008 John Resig (jquery.com) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $ + * $Rev: 5685 $ + */ + +// Map over jQuery in case of overwrite +var _jQuery = window.jQuery, +// Map over the $ in case of overwrite + _$ = window.$; + +var jQuery = window.jQuery = window.$ = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context ); +}; + +// A simple way to check for HTML strings or ID strings +// (both of which we optimize for) +var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/, + +// Is it a simple selector + isSimple = /^.[^:#\[\.]*$/, + +// Will speed up references to undefined, and allows munging its name. + undefined; + +jQuery.fn = jQuery.prototype = { + init: function( selector, context ) { + // Make sure that a selection was provided + selector = selector || document; + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this[0] = selector; + this.length = 1; + return this; + } + // Handle HTML strings + if ( typeof selector == "string" ) { + // Are we dealing with HTML string or an ID? + var match = quickExpr.exec( selector ); + + // Verify a match, and that no context was specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) + selector = jQuery.clean( [ match[1] ], context ); + + // HANDLE: $("#id") + else { + var elem = document.getElementById( match[3] ); + + // Make sure an element was located + if ( elem ){ + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id != match[3] ) + return jQuery().find( selector ); + + // Otherwise, we inject the element directly into the jQuery object + return jQuery( elem ); + } + selector = []; + } + + // HANDLE: $(expr, [context]) + // (which is just equivalent to: $(content).find(expr) + } else + return jQuery( context ).find( selector ); + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) + return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector ); + + return this.setArray(jQuery.makeArray(selector)); + }, + + // The current version of jQuery being used + jquery: "1.2.6", + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + // The number of elements contained in the matched element set + length: 0, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == undefined ? + + // Return a 'clean' array + jQuery.makeArray( this ) : + + // Return just the object + this[ num ]; + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + // Build a new jQuery matched element set + var ret = jQuery( elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + // Return the newly-formed element set + return ret; + }, + + // Force the current matched set of elements to become + // the specified array of elements (destroying the stack in the process) + // You should use pushStack() in order to do this, but maintain the stack + setArray: function( elems ) { + // Resetting the length to 0, then using the native Array push + // is a super-fast way to populate an object with array-like properties + this.length = 0; + Array.prototype.push.apply( this, elems ); + + return this; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + var ret = -1; + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem && elem.jquery ? elem[0] : elem + , this ); + }, + + attr: function( name, value, type ) { + var options = name; + + // Look for the case where we're accessing a style value + if ( name.constructor == String ) + if ( value === undefined ) + return this[0] && jQuery[ type || "attr" ]( this[0], name ); + + else { + options = {}; + options[ name ] = value; + } + + // Check to see if we're setting style values + return this.each(function(i){ + // Set all the styles + for ( name in options ) + jQuery.attr( + type ? + this.style : + this, + name, jQuery.prop( this, options[ name ], type, i, name ) + ); + }); + }, + + css: function( key, value ) { + // ignore negative width and height values + if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) + value = undefined; + return this.attr( key, value, "curCSS" ); + }, + + text: function( text ) { + if ( typeof text != "object" && text != null ) + return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); + + var ret = ""; + + jQuery.each( text || this, function(){ + jQuery.each( this.childNodes, function(){ + if ( this.nodeType != 8 ) + ret += this.nodeType != 1 ? + this.nodeValue : + jQuery.fn.text( [ this ] ); + }); + }); + + return ret; + }, + + wrapAll: function( html ) { + if ( this[0] ) + // The elements to wrap the target around + jQuery( html, this[0].ownerDocument ) + .clone() + .insertBefore( this[0] ) + .map(function(){ + var elem = this; + + while ( elem.firstChild ) + elem = elem.firstChild; + + return elem; + }) + .append(this); + + return this; + }, + + wrapInner: function( html ) { + return this.each(function(){ + jQuery( this ).contents().wrapAll( html ); + }); + }, + + wrap: function( html ) { + return this.each(function(){ + jQuery( this ).wrapAll( html ); + }); + }, + + append: function() { + return this.domManip(arguments, true, false, function(elem){ + if (this.nodeType == 1) + this.appendChild( elem ); + }); + }, + + prepend: function() { + return this.domManip(arguments, true, true, function(elem){ + if (this.nodeType == 1) + this.insertBefore( elem, this.firstChild ); + }); + }, + + before: function() { + return this.domManip(arguments, false, false, function(elem){ + this.parentNode.insertBefore( elem, this ); + }); + }, + + after: function() { + return this.domManip(arguments, false, true, function(elem){ + this.parentNode.insertBefore( elem, this.nextSibling ); + }); + }, + + end: function() { + return this.prevObject || jQuery( [] ); + }, + + find: function( selector ) { + var elems = jQuery.map(this, function(elem){ + return jQuery.find( selector, elem ); + }); + + return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ? + jQuery.unique( elems ) : + elems ); + }, + + clone: function( events ) { + // Do the clone + var ret = this.map(function(){ + if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) { + // IE copies events bound via attachEvent when + // using cloneNode. Calling detachEvent on the + // clone will also remove the events from the orignal + // In order to get around this, we use innerHTML. + // Unfortunately, this means some modifications to + // attributes in IE that are actually only stored + // as properties will not be copied (such as the + // the name attribute on an input). + var clone = this.cloneNode(true), + container = document.createElement("div"); + container.appendChild(clone); + return jQuery.clean([container.innerHTML])[0]; + } else + return this.cloneNode(true); + }); + + // Need to set the expando to null on the cloned set if it exists + // removeData doesn't work here, IE removes it from the original as well + // this is primarily for IE but the data expando shouldn't be copied over in any browser + var clone = ret.find("*").andSelf().each(function(){ + if ( this[ expando ] != undefined ) + this[ expando ] = null; + }); + + // Copy the events from the original to the clone + if ( events === true ) + this.find("*").andSelf().each(function(i){ + if (this.nodeType == 3) + return; + var events = jQuery.data( this, "events" ); + + for ( var type in events ) + for ( var handler in events[ type ] ) + jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data ); + }); + + // Return the cloned set + return ret; + }, + + filter: function( selector ) { + return this.pushStack( + jQuery.isFunction( selector ) && + jQuery.grep(this, function(elem, i){ + return selector.call( elem, i ); + }) || + + jQuery.multiFilter( selector, this ) ); + }, + + not: function( selector ) { + if ( selector.constructor == String ) + // test special case where just one selector is passed in + if ( isSimple.test( selector ) ) + return this.pushStack( jQuery.multiFilter( selector, this, true ) ); + else + selector = jQuery.multiFilter( selector, this ); + + var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; + return this.filter(function() { + return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; + }); + }, + + add: function( selector ) { + return this.pushStack( jQuery.unique( jQuery.merge( + this.get(), + typeof selector == 'string' ? + jQuery( selector ) : + jQuery.makeArray( selector ) + ))); + }, + + is: function( selector ) { + return !!selector && jQuery.multiFilter( selector, this ).length > 0; + }, + + hasClass: function( selector ) { + return this.is( "." + selector ); + }, + + val: function( value ) { + if ( value == undefined ) { + + if ( this.length ) { + var elem = this[0]; + + // We need to handle select boxes special + if ( jQuery.nodeName( elem, "select" ) ) { + var index = elem.selectedIndex, + values = [], + options = elem.options, + one = elem.type == "select-one"; + + // Nothing was selected + if ( index < 0 ) + return null; + + // Loop through all the selected options + for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { + var option = options[ i ]; + + if ( option.selected ) { + // Get the specifc value for the option + value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value; + + // We don't need an array for one selects + if ( one ) + return value; + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + + // Everything else, we just grab the value + } else + return (this[0].value || "").replace(/\r/g, ""); + + } + + return undefined; + } + + if( value.constructor == Number ) + value += ''; + + return this.each(function(){ + if ( this.nodeType != 1 ) + return; + + if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) + this.checked = (jQuery.inArray(this.value, value) >= 0 || + jQuery.inArray(this.name, value) >= 0); + + else if ( jQuery.nodeName( this, "select" ) ) { + var values = jQuery.makeArray(value); + + jQuery( "option", this ).each(function(){ + this.selected = (jQuery.inArray( this.value, values ) >= 0 || + jQuery.inArray( this.text, values ) >= 0); + }); + + if ( !values.length ) + this.selectedIndex = -1; + + } else + this.value = value; + }); + }, + + html: function( value ) { + return value == undefined ? + (this[0] ? + this[0].innerHTML : + null) : + this.empty().append( value ); + }, + + replaceWith: function( value ) { + return this.after( value ).remove(); + }, + + eq: function( i ) { + return this.slice( i, i + 1 ); + }, + + slice: function() { + return this.pushStack( Array.prototype.slice.apply( this, arguments ) ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function(elem, i){ + return callback.call( elem, i, elem ); + })); + }, + + andSelf: function() { + return this.add( this.prevObject ); + }, + + data: function( key, value ){ + var parts = key.split("."); + parts[1] = parts[1] ? "." + parts[1] : ""; + + if ( value === undefined ) { + var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); + + if ( data === undefined && this.length ) + data = jQuery.data( this[0], key ); + + return data === undefined && parts[1] ? + this.data( parts[0] ) : + data; + } else + return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){ + jQuery.data( this, key, value ); + }); + }, + + removeData: function( key ){ + return this.each(function(){ + jQuery.removeData( this, key ); + }); + }, + + domManip: function( args, table, reverse, callback ) { + var clone = this.length > 1, elems; + + return this.each(function(){ + if ( !elems ) { + elems = jQuery.clean( args, this.ownerDocument ); + + if ( reverse ) + elems.reverse(); + } + + var obj = this; + + if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) ) + obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") ); + + var scripts = jQuery( [] ); + + jQuery.each(elems, function(){ + var elem = clone ? + jQuery( this ).clone( true )[0] : + this; + + // execute all scripts after the elements have been injected + if ( jQuery.nodeName( elem, "script" ) ) + scripts = scripts.add( elem ); + else { + // Remove any inner scripts for later evaluation + if ( elem.nodeType == 1 ) + scripts = scripts.add( jQuery( "script", elem ).remove() ); + + // Inject the elements into the document + callback.call( obj, elem ); + } + }); + + scripts.each( evalScript ); + }); + } +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +function evalScript( i, elem ) { + if ( elem.src ) + jQuery.ajax({ + url: elem.src, + async: false, + dataType: "script" + }); + + else + jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); + + if ( elem.parentNode ) + elem.parentNode.removeChild( elem ); +} + +function now(){ + return +new Date; +} + +jQuery.extend = jQuery.fn.extend = function() { + // copy reference to target object + var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; + + // Handle a deep copy situation + if ( target.constructor == Boolean ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target != "object" && typeof target != "function" ) + target = {}; + + // extend jQuery itself if only one argument is passed + if ( length == i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) + // Extend the base object + for ( var name in options ) { + var src = target[ name ], copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) + continue; + + // Recurse if we're merging object values + if ( deep && copy && typeof copy == "object" && !copy.nodeType ) + target[ name ] = jQuery.extend( deep, + // Never move original objects, clone them + src || ( copy.length != null ? [ ] : { } ) + , copy ); + + // Don't bring in undefined values + else if ( copy !== undefined ) + target[ name ] = copy; + + } + + // Return the modified object + return target; +}; + +var expando = "jQuery" + now(), uuid = 0, windowData = {}, + // exclude the following css properties to add px + exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, + // cache defaultView + defaultView = document.defaultView || {}; + +jQuery.extend({ + noConflict: function( deep ) { + window.$ = _$; + + if ( deep ) + window.jQuery = _jQuery; + + return jQuery; + }, + + // See test/unit/core.js for details concerning this function. + isFunction: function( fn ) { + return !!fn && typeof fn != "string" && !fn.nodeName && + fn.constructor != Array && /^[\s[]?function/.test( fn + "" ); + }, + + // check if an element is in a (or is an) XML document + isXMLDoc: function( elem ) { + return elem.documentElement && !elem.body || + elem.tagName && elem.ownerDocument && !elem.ownerDocument.body; + }, + + // Evalulates a script in a global context + globalEval: function( data ) { + data = jQuery.trim( data ); + + if ( data ) { + // Inspired by code by Andrea Giammarchi + // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html + var head = document.getElementsByTagName("head")[0] || document.documentElement, + script = document.createElement("script"); + + script.type = "text/javascript"; + if ( jQuery.browser.msie ) + script.text = data; + else + script.appendChild( document.createTextNode( data ) ); + + // Use insertBefore instead of appendChild to circumvent an IE6 bug. + // This arises when a base node is used (#2709). + head.insertBefore( script, head.firstChild ); + head.removeChild( script ); + } + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); + }, + + cache: {}, + + data: function( elem, name, data ) { + elem = elem == window ? + windowData : + elem; + + var id = elem[ expando ]; + + // Compute a unique ID for the element + if ( !id ) + id = elem[ expando ] = ++uuid; + + // Only generate the data cache if we're + // trying to access or manipulate it + if ( name && !jQuery.cache[ id ] ) + jQuery.cache[ id ] = {}; + + // Prevent overriding the named cache with undefined values + if ( data !== undefined ) + jQuery.cache[ id ][ name ] = data; + + // Return the named cache data, or the ID for the element + return name ? + jQuery.cache[ id ][ name ] : + id; + }, + + removeData: function( elem, name ) { + elem = elem == window ? + windowData : + elem; + + var id = elem[ expando ]; + + // If we want to remove a specific section of the element's data + if ( name ) { + if ( jQuery.cache[ id ] ) { + // Remove the section of cache data + delete jQuery.cache[ id ][ name ]; + + // If we've removed all the data, remove the element's cache + name = ""; + + for ( name in jQuery.cache[ id ] ) + break; + + if ( !name ) + jQuery.removeData( elem ); + } + + // Otherwise, we want to remove all of the element's data + } else { + // Clean up the element expando + try { + delete elem[ expando ]; + } catch(e){ + // IE has trouble directly removing the expando + // but it's ok with using removeAttribute + if ( elem.removeAttribute ) + elem.removeAttribute( expando ); + } + + // Completely remove the data cache + delete jQuery.cache[ id ]; + } + }, + + // args is for internal usage only + each: function( object, callback, args ) { + var name, i = 0, length = object.length; + + if ( args ) { + if ( length == undefined ) { + for ( name in object ) + if ( callback.apply( object[ name ], args ) === false ) + break; + } else + for ( ; i < length; ) + if ( callback.apply( object[ i++ ], args ) === false ) + break; + + // A special, fast, case for the most common use of each + } else { + if ( length == undefined ) { + for ( name in object ) + if ( callback.call( object[ name ], name, object[ name ] ) === false ) + break; + } else + for ( var value = object[0]; + i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} + } + + return object; + }, + + prop: function( elem, value, type, i, name ) { + // Handle executable functions + if ( jQuery.isFunction( value ) ) + value = value.call( elem, i ); + + // Handle passing in a number to a CSS property + return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ? + value + "px" : + value; + }, + + className: { + // internal only, use addClass("class") + add: function( elem, classNames ) { + jQuery.each((classNames || "").split(/\s+/), function(i, className){ + if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) + elem.className += (elem.className ? " " : "") + className; + }); + }, + + // internal only, use removeClass("class") + remove: function( elem, classNames ) { + if (elem.nodeType == 1) + elem.className = classNames != undefined ? + jQuery.grep(elem.className.split(/\s+/), function(className){ + return !jQuery.className.has( classNames, className ); + }).join(" ") : + ""; + }, + + // internal only, use hasClass("class") + has: function( elem, className ) { + return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; + } + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback ) { + var old = {}; + // Remember the old values, and insert the new ones + for ( var name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + callback.call( elem ); + + // Revert the old values + for ( var name in options ) + elem.style[ name ] = old[ name ]; + }, + + css: function( elem, name, force ) { + if ( name == "width" || name == "height" ) { + var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; + + function getWH() { + val = name == "width" ? elem.offsetWidth : elem.offsetHeight; + var padding = 0, border = 0; + jQuery.each( which, function() { + padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; + border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; + }); + val -= Math.round(padding + border); + } + + if ( jQuery(elem).is(":visible") ) + getWH(); + else + jQuery.swap( elem, props, getWH ); + + return Math.max(0, val); + } + + return jQuery.curCSS( elem, name, force ); + }, + + curCSS: function( elem, name, force ) { + var ret, style = elem.style; + + // A helper method for determining if an element's values are broken + function color( elem ) { + if ( !jQuery.browser.safari ) + return false; + + // defaultView is cached + var ret = defaultView.getComputedStyle( elem, null ); + return !ret || ret.getPropertyValue("color") == ""; + } + + // We need to handle opacity special in IE + if ( name == "opacity" && jQuery.browser.msie ) { + ret = jQuery.attr( style, "opacity" ); + + return ret == "" ? + "1" : + ret; + } + // Opera sometimes will give the wrong display answer, this fixes it, see #2037 + if ( jQuery.browser.opera && name == "display" ) { + var save = style.outline; + style.outline = "0 solid black"; + style.outline = save; + } + + // Make sure we're using the right name for getting the float value + if ( name.match( /float/i ) ) + name = styleFloat; + + if ( !force && style && style[ name ] ) + ret = style[ name ]; + + else if ( defaultView.getComputedStyle ) { + + // Only "float" is needed here + if ( name.match( /float/i ) ) + name = "float"; + + name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); + + var computedStyle = defaultView.getComputedStyle( elem, null ); + + if ( computedStyle && !color( elem ) ) + ret = computedStyle.getPropertyValue( name ); + + // If the element isn't reporting its values properly in Safari + // then some display: none elements are involved + else { + var swap = [], stack = [], a = elem, i = 0; + + // Locate all of the parent display: none elements + for ( ; a && color(a); a = a.parentNode ) + stack.unshift(a); + + // Go through and make them visible, but in reverse + // (It would be better if we knew the exact display type that they had) + for ( ; i < stack.length; i++ ) + if ( color( stack[ i ] ) ) { + swap[ i ] = stack[ i ].style.display; + stack[ i ].style.display = "block"; + } + + // Since we flip the display style, we have to handle that + // one special, otherwise get the value + ret = name == "display" && swap[ stack.length - 1 ] != null ? + "none" : + ( computedStyle && computedStyle.getPropertyValue( name ) ) || ""; + + // Finally, revert the display styles back + for ( i = 0; i < swap.length; i++ ) + if ( swap[ i ] != null ) + stack[ i ].style.display = swap[ i ]; + } + + // We should always get a number back from opacity + if ( name == "opacity" && ret == "" ) + ret = "1"; + + } else if ( elem.currentStyle ) { + var camelCase = name.replace(/\-(\w)/g, function(all, letter){ + return letter.toUpperCase(); + }); + + ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { + // Remember the original values + var left = style.left, rsLeft = elem.runtimeStyle.left; + + // Put in the new values to get a computed value out + elem.runtimeStyle.left = elem.currentStyle.left; + style.left = ret || 0; + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + elem.runtimeStyle.left = rsLeft; + } + } + + return ret; + }, + + clean: function( elems, context ) { + var ret = []; + context = context || document; + // !context.createElement fails in IE with an error but returns typeof 'object' + if (typeof context.createElement == 'undefined') + context = context.ownerDocument || context[0] && context[0].ownerDocument || document; + + jQuery.each(elems, function(i, elem){ + if ( !elem ) + return; + + if ( elem.constructor == Number ) + elem += ''; + + // Convert html string into DOM nodes + if ( typeof elem == "string" ) { + // Fix "XHTML"-style tags in all browsers + elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ + return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? + all : + front + ">"; + }); + + // Trim whitespace, otherwise indexOf won't work as expected + var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div"); + + var wrap = + // option or optgroup + !tags.indexOf("", "" ] || + + !tags.indexOf("", "" ] || + + tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && + [ 1, "", "
" ] || + + !tags.indexOf("", "" ] || + + // matched above + (!tags.indexOf("", "" ] || + + !tags.indexOf("", "" ] || + + // IE can't serialize and + + + + + + + + + +

+
+

Cleopatra Minimarket

+
+
+ +
+ Karyawan +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NIK: + + + + +
Nama: + +

Username: + +
Password Lama: + +
Password Baru: + +

ID Pekerjaan: + + +
ID Department: + +

+ +
+
+
+ +
+ +
+
Cari Karyawan
+
+ +
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + diff --git a/old-source/lap_cekpelanggangroup.php b/old-source/lap_cekpelanggangroup.php new file mode 100644 index 0000000..2d10abe --- /dev/null +++ b/old-source/lap_cekpelanggangroup.php @@ -0,0 +1,202 @@ + + + + Cleopatra + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Daftar Pelanggan Group + "; + echo "div#divprint{width:950px; border:0px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:950px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:10pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center; background-color : #BABABA;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $ktp = $_POST['ktp']; + $nama = $_POST['nama']; + $member = $_POST['member']; + + $dbh1 = mysql_connect($hostname, $username, $password); + $dbh2 = mysql_connect($hostname, $username, $password, true); + $dbh3 = mysql_connect($hostname, $username, $password, true); + $dbh4 = mysql_connect($hostname, $username, $password, true); + $dbh5 = mysql_connect($hostname, $username, $password, true); + $dbh6 = mysql_connect($hostname, $username, $password, true); + $dbh7 = mysql_connect($hostname, $username, $password, true); + $dbh8 = mysql_connect($hostname, $username, $password, true); + $dbh9 = mysql_connect($hostname, $username, $password, true); + + mysql_select_db('amigo01', $dbh1); + mysql_select_db('amigo02', $dbh2); + mysql_select_db('amigo03', $dbh3); + mysql_select_db('amigo04', $dbh4); + mysql_select_db('amigo05', $dbh5); + mysql_select_db('amigo06', $dbh6); + mysql_select_db('amigo07', $dbh7); + mysql_select_db('amigo08', $dbh8); + mysql_select_db('amigo09', $dbh9); + + if(!empty($ktp) and !empty($nama)){ + $querydbh1 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp' and nama like '%$nama%'", $dbh1); + $querydbh2 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp' and nama like '%$nama%'", $dbh2); + $querydbh3 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp' and nama like '%$nama%'", $dbh3); + $querydbh4 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp' and nama like '%$nama%'", $dbh4); + $querydbh5 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp' and nama like '%$nama%'", $dbh5); + $querydbh6 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp' and nama like '%$nama%'", $dbh6); + $querydbh7 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp' and nama like '%$nama%'", $dbh7); + $querydbh8 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp' and nama like '%$nama%'", $dbh8); + $querydbh9 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp' and nama like '%$nama%'", $dbh9); + }elseif(!empty($ktp) and empty($nama)){ + $querydbh1 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp'", $dbh1); + $querydbh2 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp'", $dbh2); + $querydbh3 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp'", $dbh3); + $querydbh4 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp'", $dbh4); + $querydbh5 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp'", $dbh5); + $querydbh6 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp'", $dbh6); + $querydbh7 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp'", $dbh7); + $querydbh8 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp'", $dbh8); + $querydbh9 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where ktp='$ktp'", $dbh9); + }elseif(empty($ktp) and !empty($nama)){ + $querydbh1 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where nama like '%$nama%'", $dbh1); + $querydbh2 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where nama like '%$nama%'", $dbh2); + $querydbh3 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where nama like '%$nama%'", $dbh3); + $querydbh4 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where nama like '%$nama%'", $dbh4); + $querydbh5 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where nama like '%$nama%'", $dbh5); + $querydbh6 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where nama like '%$nama%'", $dbh6); + $querydbh7 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where nama like '%$nama%'", $dbh7); + $querydbh8 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where nama like '%$nama%'", $dbh8); + $querydbh9 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where nama like '%$nama%'", $dbh9); + }elseif(!empty($member)){ + $querydbh1 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where kd_customer = '$member' or alias = '$member'", $dbh1); + $querydbh2 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where kd_customer = '$member' or alias = '$member'", $dbh2); + $querydbh3 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where kd_customer = '$member' or alias = '$member'", $dbh3); + $querydbh4 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where kd_customer = '$member' or alias = '$member'", $dbh4); + $querydbh5 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where kd_customer = '$member' or alias = '$member'", $dbh5); + $querydbh6 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where kd_customer = '$member' or alias = '$member'", $dbh6); + $querydbh7 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where kd_customer = '$member' or alias = '$member'", $dbh7); + $querydbh8 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where kd_customer = '$member' or alias = '$member'", $dbh8); + $querydbh9 = mysql_query("select p.kd_customer,p.alias,DATE_FORMAT(p.member,'%d-%m-%Y') member,p.nama,alamat,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline from pelanggan p where kd_customer = '$member' or alias = '$member'", $dbh9); + }else{ + echo "Masukkan No.KTP atau Nama atau Member"; + } + print("
"); + print(""); + for ($n = 1; $n < 10; $n++){ + if($n == 1){ + $namatoko = "Bimbo"; + }elseif($n == 2){ + $namatoko = "Granada"; + }elseif($n == 3){ + $namatoko = "A.Klaten"; + }elseif($n == 4){ + $namatoko = "Dinasti"; + }elseif($n == 5){ + $namatoko = "A.Pedan"; + }elseif($n == 6){ + $namatoko = "A.Sukoharjo"; + }elseif($n == 7){ + $namatoko = "A.Boyolali"; + }elseif($n == 8){ + $namatoko = "A.Wonosari"; + }elseif($n == 9){ + $namatoko = "A.Karanganyar"; + } + + $query = '$querydbh'.$n; + if($query == '$querydbh1'){ + $querydb = $querydbh1; + }elseif($query == '$querydbh2'){ + $querydb = $querydbh2; + }elseif($query == '$querydbh3'){ + $querydb = $querydbh3; + }elseif($query == '$querydbh4'){ + $querydb = $querydbh4; + }elseif($query == '$querydbh5'){ + $querydb = $querydbh5; + }elseif($query == '$querydbh6'){ + $querydb = $querydbh6; + }elseif($query == '$querydbh7'){ + $querydb = $querydbh7; + }elseif($query == '$querydbh8'){ + $querydb = $querydbh8; + }elseif($query == '$querydbh9'){ + $querydb = $querydbh9; + } + + + if ($n != $n - 1){ + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + } + while($row=mysql_fetch_array($querydb)){ + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + } + + } + print("
$namatoko"; + print "
Kd.CustNo.AMCTgl.MemberNamaAlamatUplineAction
$row[kd_customer]$row[alias]$row[member]$row[nama]$row[alamat]$row[nama_upline]ADOPSI

"); + print("
"); + + + ?> +
+
+ +
+ + + + +?> \ No newline at end of file diff --git a/old-source/lap_cekpoinplg.php b/old-source/lap_cekpoinplg.php new file mode 100644 index 0000000..9369c56 --- /dev/null +++ b/old-source/lap_cekpoinplg.php @@ -0,0 +1,303 @@ + + + + Cleopatra + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Poin Pelanggan + "; + echo "div#divprint{width:900px; border:0px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:850px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:10pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $kdplg = $_POST['kodeplg']; + + + $dbh1 = mysql_connect($hostname, $username, $password); + $dbh2 = mysql_connect($hostname, $username, $password, true); + $dbh3 = mysql_connect($hostname, $username, $password, true); + $dbh4 = mysql_connect($hostname, $username, $password, true); + $dbh5 = mysql_connect($hostname, $username, $password, true); + $dbh6 = mysql_connect($hostname, $username, $password, true); + $dbh7 = mysql_connect($hostname, $username, $password, true); + $dbh8 = mysql_connect($hostname, $username, $password, true); + $dbh9 = mysql_connect($hostname, $username, $password, true); + + mysql_select_db('amigo01', $dbh1); + mysql_select_db('amigo02', $dbh2); + mysql_select_db('amigo03', $dbh3); + mysql_select_db('amigo04', $dbh4); + mysql_select_db('amigo05', $dbh5); + mysql_select_db('amigo06', $dbh6); + mysql_select_db('amigo07', $dbh7); + mysql_select_db('amigo08', $dbh8); + mysql_select_db('amigo09', $dbh9); + + if(!empty($kdplg)){ + $querydbh1 = mysql_query("SELECT p.kd_customer,p.alamat,p.nama,sum(jumlah_total) total, floor(sum(jumlah_total)/100000) poin + FROM pelanggan p, m_nota_tunai m + WHERE + m.status_nota = 'S' + and p.kd_customer = m.kd_customer + and m.kd_customer != '' + and (p.kd_customer = '$kdplg' OR p.alias = '$kdplg') + GROUP BY p.kd_customer", $dbh1); + $querydbh2 = mysql_query("SELECT p.kd_customer,p.alamat,p.nama,sum(jumlah_total) total, floor(sum(jumlah_total)/100000) poin + FROM pelanggan p, m_nota_tunai m + WHERE + m.status_nota = 'S' + and p.kd_customer = m.kd_customer + and m.kd_customer != '' + and (p.kd_customer = '$kdplg' OR p.alias = '$kdplg') + GROUP BY p.kd_customer", $dbh2); + $querydbh3 = mysql_query("SELECT p.kd_customer,p.alamat,p.nama,sum(jumlah_total) total, floor(sum(jumlah_total)/100000) poin + FROM pelanggan p, m_nota_tunai m + WHERE + m.status_nota = 'S' + and p.kd_customer = m.kd_customer + and m.kd_customer != '' + and (p.kd_customer = '$kdplg' OR p.alias = '$kdplg') + GROUP BY p.kd_customer", $dbh3); + $querydbh4 = mysql_query("SELECT p.kd_customer,p.alamat,p.nama,sum(jumlah_total) total, floor(sum(jumlah_total)/100000) poin + FROM pelanggan p, m_nota_tunai m + WHERE + m.status_nota = 'S' + and p.kd_customer = m.kd_customer + and m.kd_customer != '' + and (p.kd_customer = '$kdplg' OR p.alias = '$kdplg') + GROUP BY p.kd_customer", $dbh4); + $querydbh5 = mysql_query("SELECT p.kd_customer,p.alamat,p.nama,sum(jumlah_total) total, floor(sum(jumlah_total)/100000) poin + FROM pelanggan p, m_nota_tunai m + WHERE + m.status_nota = 'S' + and p.kd_customer = m.kd_customer + and m.kd_customer != '' + and (p.kd_customer = '$kdplg' OR p.alias = '$kdplg') + GROUP BY p.kd_customer", $dbh5); + $querydbh6 = mysql_query("SELECT p.kd_customer,p.alamat,p.nama,sum(jumlah_total) total, floor(sum(jumlah_total)/100000) poin + FROM pelanggan p, m_nota_tunai m + WHERE + m.status_nota = 'S' + and p.kd_customer = m.kd_customer + and m.kd_customer != '' + and (p.kd_customer = '$kdplg' OR p.alias = '$kdplg') + GROUP BY p.kd_customer", $dbh6); + $querydbh7 = mysql_query("SELECT p.kd_customer,p.alamat,p.nama,sum(jumlah_total) total, floor(sum(jumlah_total)/100000) poin + FROM pelanggan p, m_nota_tunai m + WHERE + m.status_nota = 'S' + and p.kd_customer = m.kd_customer + and m.kd_customer != '' + and (p.kd_customer = '$kdplg' OR p.alias = '$kdplg') + GROUP BY p.kd_customer", $dbh7); + $querydbh8 = mysql_query("SELECT p.kd_customer,p.alamat,p.nama,sum(jumlah_total) total, floor(sum(jumlah_total)/100000) poin + FROM pelanggan p, m_nota_tunai m + WHERE + m.status_nota = 'S' + and p.kd_customer = m.kd_customer + and m.kd_customer != '' + and (p.kd_customer = '$kdplg' OR p.alias = '$kdplg') + GROUP BY p.kd_customer", $dbh8); + $querydbh9 = mysql_query("SELECT p.kd_customer,p.alamat,p.nama,sum(jumlah_total) total, floor(sum(jumlah_total)/100000) poin + FROM pelanggan p, m_nota_tunai m + WHERE + m.status_nota = 'S' + and p.kd_customer = m.kd_customer + and m.kd_customer != '' + and (p.kd_customer = '$kdplg' OR p.alias = '$kdplg') + GROUP BY p.kd_customer", $dbh9); + }else{ + echo "Masukkan kode pelanggan"; + } + + + //amigo01 + print("
"); + print(""); + while($rowdbh1=mysql_fetch_array($querydbh1)){ + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + $total1 = $rowdbh1['total']; + $poin1 = $rowdbh1['poin']; + } + print("
$rowdbh1[kd_customer]$rowdbh1[nama]$rowdbh1[alamat]".number_format($rowdbh1[total],0,',','.')."$rowdbh1[poin]

"); + //amigo02 + print(""); + while($rowdbh2=mysql_fetch_array($querydbh2)){ + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + $total2 = $rowdbh2['total']; + $poin2 = $rowdbh2['poin']; + } + print("
$rowdbh2[kd_customer]$rowdbh2[nama]$rowdbh2[alamat]".number_format($rowdbh2[total],0,',','.')."$rowdbh2[poin]

"); + //amigo03 + print(""); + while($rowdbh3=mysql_fetch_array($querydbh3)){ + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + $total3 = $rowdbh3['total']; + $poin3 = $rowdbh3['poin']; + } + print("
$rowdbh3[kd_customer]$rowdbh3[nama]$rowdbh3[alamat]".number_format($rowdbh3[total],0,',','.')."$rowdbh3[poin]

"); + //amigo04 + print(""); + while($rowdbh4=mysql_fetch_array($querydbh4)){ + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + $total4 = $rowdbh4['total']; + $poin4 = $rowdbh4['poin']; + } + print("
$rowdbh4[kd_customer]$rowdbh4[nama]$rowdbh4[alamat]".number_format($rowdbh4[total],0,',','.')."$rowdbh4[poin]

"); + //amigo05 + print(""); + while($rowdbh5=mysql_fetch_array($querydbh5)){ + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + $total5 = $rowdbh5['total']; + $poin5 = $rowdbh5['poin']; + } + print("
$rowdbh5[kd_customer]$rowdbh5[nama]$rowdbh5[alamat]".number_format($rowdbh5[total],0,',','.')."$rowdbh5[poin]

"); + //amigo06 + print(""); + while($rowdbh6=mysql_fetch_array($querydbh6)){ + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + $total6 = $rowdbh6['total']; + $poin6 = $rowdbh6['poin']; + } + print("
$rowdbh6[kd_customer]$rowdbh6[nama]$rowdbh6[alamat]".number_format($rowdbh6[total],0,',','.')."$rowdbh6[poin]

"); + //amigo07 + print(""); + while($rowdbh7=mysql_fetch_array($querydbh7)){ + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + $total7 = $rowdbh7['total']; + $poin7 = $rowdbh7['poin']; + } + print("
$rowdbh7[kd_customer]$rowdbh7[nama]$rowdbh7[alamat]".number_format($rowdbh7[total],0,',','.')."$rowdbh7[poin]

"); + //amigo08 + print(""); + while($rowdbh8=mysql_fetch_array($querydbh8)){ + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + $total8 = $rowdbh8['total']; + $poin8 = $rowdbh8['poin']; + } + print("
$rowdbh8[kd_customer]$rowdbh8[nama]$rowdbh8[alamat]".number_format($rowdbh8[total],0,',','.')."$rowdbh8[poin]

"); + //amigo09 + print(""); + while($rowdbh9=mysql_fetch_array($querydbh9)){ + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + $total9 = $rowdbh9['total']; + $poin9 = $rowdbh9['poin']; + } + print("
$rowdbh9[kd_customer]$rowdbh9[nama]$rowdbh9[alamat]".number_format($rowdbh9[total],0,',','.')."$rowdbh9[poin]

"); + + $total_blj = $total1+$total2+$total3+$total4+$total5+$total6+$total7+$total8+$total9; + $total_poin = $poin1+$poin2+$poin3+$poin4+$poin5+$poin6+$poin7+$poin8+$poin9; + print(""); + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print("
Total Belanja".number_format($total_blj,0,',','.')."
Total Poin".number_format($total_poin,0,',','.')."

"); + + print("
"); + + + ?> +
+
+ +
+ + + + +?> \ No newline at end of file diff --git a/old-source/lap_historyplg.php b/old-source/lap_historyplg.php new file mode 100644 index 0000000..bd2dee0 --- /dev/null +++ b/old-source/lap_historyplg.php @@ -0,0 +1,277 @@ + + + + Cleopatra + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ History Pelanggan + "; + echo "div#divprint{width:900px; border:0px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:875px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "table.tbl1 {width:900px;border-width:0 0 0 0;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:left;}"; + echo "table.tbl1,table.tbl1 td {border-color:#000;border-style:solid;}"; + echo "table.tbl1 td {margin:0;padding:2px;border-width:0 0 0 0;}"; + echo "body {font-size:10pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $kdplg = $_POST['kodeplg']; + + $dbh = mysql_connect(HOST,USER,PASSWORD); + $dbh1 = mysql_connect($hostname, $username, $password); + $dbh2 = mysql_connect($hostname, $username, $password, true); + $dbh3 = mysql_connect($hostname, $username, $password, true); + $dbh4 = mysql_connect($hostname, $username, $password, true); + $dbh5 = mysql_connect($hostname, $username, $password, true); + $dbh6 = mysql_connect($hostname, $username, $password, true); + $dbh7 = mysql_connect($hostname, $username, $password, true); + $dbh8 = mysql_connect($hostname, $username, $password, true); + $dbh9 = mysql_connect($hostname, $username, $password, true); + + mysql_select_db(DATABASE,$dbh); + mysql_select_db('amigo01', $dbh1); + mysql_select_db('amigo02', $dbh2); + mysql_select_db('amigo03', $dbh3); + mysql_select_db('amigo04', $dbh4); + mysql_select_db('amigo05', $dbh5); + mysql_select_db('amigo06', $dbh6); + mysql_select_db('amigo07', $dbh7); + mysql_select_db('amigo08', $dbh8); + mysql_select_db('amigo09', $dbh9); + + if(!empty($kdplg)){ + $querydbhA1 = mysql_query("SELECT p.kd_customer,p.alias,p.ktp,p.nama,p.alamat,p.wilayah,DATE_FORMAT(p.tgl_lahir,'%d-%m-%Y') tanggal_lahir,(year(curdate())-year(tgl_lahir)) as umur, + case agama + when 1 then 'Islam' + when 2 then 'Katholik' + when 3 then 'Kristen' + when 4 then 'Budha' + when 5 then 'Hindu' + when 6 then 'Lainnya' + end as agama, + case pekerjaan + when 1 then 'Ibu Rumah Tangga' + when 2 then 'Profesional' + when 3 then 'TNI / POLRI' + when 4 then 'Guru / Dosen' + when 5 then 'Karyawan / Staf BUM Swasta' + when 6 then 'Buruh' + when 7 then 'Pensiunan / Purnawirawan' + when 8 then 'Pegawai Negeri Sipil' + when 9 then 'Pelajar / Mahasiswa' + when 10 then 'Wiraswasta' + when 11 then 'Belum / Tidak Bekerja' + when 12 then 'Karyawan / Staf BUMN / BUMD' + when 13 then 'Pejabat Pemerintah' + when 14 then 'Rohaniawan' + when 15 then 'Seniman' + end as jns_pekerjaan,(select p2.nama from pelanggan p2 where p2.kd_customer=p.upline) nama_upline + FROM pelanggan p + WHERE p.kd_customer = '$kdplg' OR p.alias = '$kdplg'", $dbh); + + //localhost + print("
"); + print(""); + while($rowdbhA1=mysql_fetch_array($querydbhA1)){ + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + } + print("
Kd.Pelanggan$rowdbhA1[kd_customer]Nama$rowdbhA1[nama]Tgl Lahir,Usia$rowdbhA1[tanggal_lahir], $rowdbhA1[umur]thNama Upline$rowdbhA1[nama_upline]
Kd.Kartu$rowdbhA1[alias]Alamat$rowdbhA1[alamat]Agama$rowdbhA1[agama]
No.KTP$rowdbhA1[ktp]$rowdbhA1[wilayah]Pekerjaan$rowdbhA1[jns_pekerjaan]

"); + print "
"; + + print "
"; + print "Transaksi Tunai periode ".encTgl($startDate) ." s/d ".encTgl($endDate).""; + + $tmp_total1 = 0; + $tmp_poin1 = 0; + $tmp_total2 = 0; + $tmp_poin2 = 0; + $tmp_total = 0; + $tmp_poin = 0; + for ($n = 1; $n < 10; $n++){ + $database = '$dbh'.$n; + + if($database == '$dbh1'){ + $data = $dbh1; + }elseif($database == '$dbh2'){ + $data = $dbh2; + }elseif($database == '$dbh3'){ + $data = $dbh3; + }elseif($database == '$dbh4'){ + $data = $dbh4; + }elseif($database == '$dbh5'){ + $data = $dbh5; + }elseif($database == '$dbh6'){ + $data = $dbh6; + }elseif($database == '$dbh7'){ + $data = $dbh7; + }elseif($database == '$dbh8'){ + $data = $dbh8; + }elseif($database == '$dbh9'){ + $data = $dbh9; + } + + $querydbh[$n] = mysql_query("select m.no_nota,m.tgl_nota, m.kd_customer, m.jumlah_total, floor(jumlah_total/100000) poin + FROM m_nota_tunai m, pelanggan p + where m.status_bayar = 'T' + and m.status_nota = 'S' + and m.no_nota_retur = '' + and p.kd_customer = m.kd_customer + and m.kd_customer != '' + and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' + and (p.kd_customer = '$kdplg' OR p.alias = '$kdplg') + order by m.tgl_nota", $data); + + print(""); + $query = $querydbh[$n]; + while($row=mysql_fetch_array($query)){ + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + $tmp_total1 += $row[jumlah_total]; + $tmp_poin1 += $row[poin]; + } + print("
$row[no_nota]$row[tgl_nota]".number_format($row[jumlah_total],0,',','.')."".number_format($row[poin],0,',','.')."

"); + + } + + print "
"; + print "
"; +// print "
"; +// print "Transaksi Tukar Tambah periode ".encTgl($startDate) ." s/d ".encTgl($endDate).""; +// +// for ($n = 1; $n < 10; $n++){ +// $dtbase = '$dbh'.$n; +// +// if($dtbase == '$dbh1'){ +// $dta = $dbh1; +// }elseif($dtbase == '$dbh2'){ +// $dta = $dbh2; +// }elseif($dtbase == '$dbh3'){ +// $dta = $dbh3; +// }elseif($dtbase == '$dbh4'){ +// $dta = $dbh4; +// }elseif($dtbase == '$dbh5'){ +// $dta = $dbh5; +// }elseif($dtbase == '$dbh6'){ +// $dta = $dbh6; +// }elseif($dtbase == '$dbh7'){ +// $dta = $dbh7; +// }elseif($dtbase == '$dbh8'){ +// $dta = $dbh8; +// }elseif($dtbase == '$dbh9'){ +// $dta = $dbh9; +// } +// +// $querydbhB[$n] = mysql_query("SELECT m.no_nota,m.tgl_nota, m.kd_customer, m.jumlah_total, +// m.no_nota_retur, m.jumlah_total_retur,floor(m.jumlah_total_retur/100000) poin +// FROM m_nota_tunai m, pelanggan p +// WHERE m.status_bayar = 'T' +// and m.no_nota_retur != '' +// and m.status_nota = 'S' +// and m.kd_customer = p.kd_customer +// and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' +// and (p.kd_customer = '$kdplg' OR p.alias = '$kdplg') +// ORDER BY m.tgl_nota", $dta); +// print(""); +// $querydb = $querydbhB[$n]; +// while($rowdb=mysql_fetch_array($querydb)){ +// print ""; +// print ""; +// print ""; +// print ""; +// print ""; +// print ""; +// print ""; +// $tmp_total2 += $rowdb[jumlah_total_retur]; +// $tmp_poin2 += $rowdb[poin]; +// } +// print("
$rowdb[no_nota]$rowdb[tgl_nota]$rowdb[no_nota_retur]".number_format($rowdb[jumlah_total_retur],0,',','.')."".number_format($rowdb[poin],0,',','.')."

"); +// } +// print "
"; +// +// $tmp_total = $tmp_total1 + $tmp_total2; +// $tmp_poin = $tmp_poin1 + $tmp_poin2; + + print "
"; + print "TOTAL POIN"; + print(""); + print ""; + print ""; + print("
Rupiah Transaksi".number_format($tmp_total1,0,',','.')."
Total POIN".number_format($tmp_poin1,0,',','.')."

"); + print "
"; + + }else{ + echo "Masukkan kode pelanggan"; + } + + ?> +
+
+ +
+ + + diff --git a/old-source/lap_profitperjnspekerjaan.php b/old-source/lap_profitperjnspekerjaan.php new file mode 100644 index 0000000..ea0fdae --- /dev/null +++ b/old-source/lap_profitperjnspekerjaan.php @@ -0,0 +1,120 @@ + + + + Cleopatra + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Report Pelanggan Tunai + "; + echo "div#divprint{width:900px; border:0px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:850px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:10pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + require_once 'db_login.inc.php'; + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $stmt = $mysqli->query("SELECT case pekerjaan + when 1 then 'Ibu Rumah Tangga' + when 2 then 'Profesional' + when 3 then 'TNI / POLRI' + when 4 then 'Guru / Dosen' + when 5 then 'Karyawan / Staf BUM Swasta' + when 6 then 'Buruh' + when 7 then 'Pensiunan / Purnawirawan' + when 8 then 'Pegawai Negeri Sipil' + when 9 then 'Pelajar / Mahasiswa' + when 10 then 'Wiraswasta' + when 11 then 'Belum / Tidak Bekerja' + when 12 then 'Karyawan / Staf BUMN / BUMD' + when 13 then 'Pejabat Pemerintah' + when 14 then 'Rohaniawan' + when 15 then 'Seniman' + end as jns_pekerjaan,count(m.no_nota) jmlTransaksi,sum(m.jumlah_total) rpTransaksi, hp,sum(m.jumlah_total)-hp bathi, (sum(m.jumlah_total)-hp)/sum(m.jumlah_total)*100 profit + FROM pelanggan p, m_nota_tunai m,(select p.pekerjaan IDpekerjaan,sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m, pelanggan p + where d.no_nota = m.no_nota + and p.kd_customer = m.kd_customer + and d.harga_pokok IS NOT NULL + and m.status_nota = 'S' + and date(m.tgl_nota) between '$startDate' and '$endDate' + group by p.pekerjaan + ) tmpDetail + WHERE + p.pekerjaan = tmpDetail.IDpekerjaan + and p.kd_customer = m.kd_customer + and m.status_nota = 'S' + and date(m.tgl_nota) between '$startDate' and '$endDate' + GROUP BY p.pekerjaan + ORDER BY jns_pekerjaan + "); + if($stmt->num_rows > 0) { + print("
"); + print(""); + print(""); + + while($a = $stmt->fetch_array(MYSQLI_ASSOC)) { + $id_pekerjaan = $a['jns_pekerjaan']; + $juml = $a['jmlTransaksi']; + $rp = $a['rpTransaksi']; + $hp = $a['hp']; + $cwan = $a['bathi']; + $profit = $a['profit']; + + print(" + + + "); + } + print("
Jenis PekerjaanJumlah TransaksiRupiah TransaksiTot Hrg PokokLabaProfit
$id_pekerjaan$juml".number_format($rp, 0, ",", ".")."".number_format($hp, 0, ",", ".")."".number_format($cwan, 0, ",", ".")."".number_format($profit, 2, ",", ".")."

"); + print("
"); + + $stmt->close(); + } + $mysqli->close(); + ?> +
+
+ +
+ + + + +?> \ No newline at end of file diff --git a/old-source/lap_profitperplg.php b/old-source/lap_profitperplg.php new file mode 100644 index 0000000..93a6ef1 --- /dev/null +++ b/old-source/lap_profitperplg.php @@ -0,0 +1,115 @@ + + + + Cleopatra + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Report Pelanggan Tunai + "; + echo "div#divprint{width:900px; border:0px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:850px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:10pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + require_once 'db_login.inc.php'; + $startDate = decTgl($_POST['startDate']); // '2013-07-01' and '2013-08-31' + $endDate = decTgl($_POST['endDate']); + + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $stmt = $mysqli->query("SELECT p.kd_customer,p.nama,sum(floor(m.jumlah_total/100000)) poin,count(m.no_nota) jmlTransaksi,sum(m.jumlah_total) rpTransaksi, tmpDetail.hp,sum(m.jumlah_total)-tmpDetail.hp bathi, (sum(m.jumlah_total)-tmpDetail.hp)/sum(m.jumlah_total)*100 profit + FROM pelanggan p, m_nota_tunai m, + (select p.kd_customer, p.nama,sum(d.jumlah*REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(d.harga_pokok,'B','1'),'R','2'),'A','3'),'W','4'),'N','5'),'F','6'),'O','7'),'X','8'),'E','9'),'S','0')) hp + from d_nota_tunai d,m_nota_tunai m, pelanggan p + where d.no_nota = m.no_nota + and p.kd_customer = m.kd_customer + and d.harga_pokok IS NOT NULL + and m.status_bayar = 'T' + and m.no_nota_retur = '' + and m.kd_customer != '' + and m.status_nota = 'S' + and date(m.tgl_nota) between '$startDate' and '$endDate' + group by p.kd_customer + ) tmpDetail + WHERE + m.status_bayar = 'T' + and m.no_nota_retur = '' + and m.kd_customer != '' + and m.status_nota = 'S' + and p.kd_customer = tmpDetail.kd_customer + and p.kd_customer = m.kd_customer + and date(m.tgl_nota) between '$startDate' and '$endDate' + GROUP BY p.kd_customer + ORDER BY poin DESC + "); + if($stmt->num_rows > 0) { + print("
"); + print(""); + print(""); + + while($a = $stmt->fetch_array(MYSQLI_ASSOC)) { + $kdplg = $a['kd_customer']; + $nama = $a['nama']; + $point = $a['poin']; + $juml = $a['jmlTransaksi']; + $rp = $a['rpTransaksi']; + $hp = $a['hp']; + $cwan = $a['bathi']; + $profit = $a['profit']; + + print(" + + + + + "); + } + print("
Kd.PlgNamaPOINJML Trans.Rp Trans.Tot HPLabaProfit(%)
$kdplg$nama$point$juml".number_format($rp, 0, ",", ".")."".number_format($hp, 0, ",", ".")."".number_format($cwan, 0, ",", ".")."".number_format($profit, 2, ",", ".")."

"); + print("
"); + + $stmt->close(); + } + $mysqli->close(); + ?> +
+
+ +
+ + + + +?> \ No newline at end of file diff --git a/old-source/lap_transaksiperjnspekerjaan.php b/old-source/lap_transaksiperjnspekerjaan.php new file mode 100644 index 0000000..6e3b35e --- /dev/null +++ b/old-source/lap_transaksiperjnspekerjaan.php @@ -0,0 +1,115 @@ + + + + Cleopatra + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Report Pelanggan Tunai + "; + echo "div#divprint{width:900px; border:0px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:850px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:10pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + require_once 'db_login.inc.php'; + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $stmt = $mysqli->query("select case pekerjaan + when 1 then 'Ibu Rumah Tangga' + when 2 then 'Profesional' + when 3 then 'TNI / POLRI' + when 4 then 'Guru / Dosen' + when 5 then 'Karyawan / Staf BUM Swasta' + when 6 then 'Buruh' + when 7 then 'Pensiunan / Purnawirawan' + when 8 then 'Pegawai Negeri Sipil' + when 9 then 'Pelajar / Mahasiswa' + when 10 then 'Wiraswasta' + when 11 then 'Belum / Tidak Bekerja' + when 12 then 'Karyawan / Staf BUMN / BUMD' + when 13 then 'Pejabat Pemerintah' + when 14 then 'Rohaniawan' + when 15 then 'Seniman' + end as jns_pekerjaan,count(m.no_nota) jmlTransaksi,sum(m.jumlah_total) rpTransaksi + from pelanggan p, m_nota_tunai m + where p.kd_customer = m.kd_customer + and m.status_nota = 'S' + and date(m.tgl_nota) between '$startDate' and '$endDate' + group by p.pekerjaan + order by jns_pekerjaan"); + $totkosong = 0; + $totisi = 0; + if($stmt->num_rows > 0) { + print("
"); + print(""); + print(""); + + while($a = $stmt->fetch_array(MYSQLI_ASSOC)) { + $id_pekerjaan = $a['jns_pekerjaan']; + $juml = $a['jmlTransaksi']; + $rp = $a['rpTransaksi']; + if ($id_pekerjaan == "") + $totkosong += $juml; + else + $totisi += $juml; + + print(""); + + } + print("
Jenis PekerjaanJumlah TransaksiRupiah Transaksi
$id_pekerjaan$juml".number_format($rp, 0, ",", ".")."

"); + print("
"); + $stmt->close(); + } + $prosenkosong = $totkosong/($totkosong+$totisi)*100; + $prosenisi = $totisi/($totkosong+$totisi)*100; + print("Yang kosong = ". $totkosong." =>".number_format($prosenkosong, 2, ",", ".")."%"); + print("
"); + print("Yang isi = ". $totisi." =>".number_format($prosenisi, 2, ",", ".")."%"); + + $mysqli->close(); + ?> +
+
+ +
+ + + + +?> \ No newline at end of file diff --git a/old-source/lapbayar.php b/old-source/lapbayar.php new file mode 100644 index 0000000..ba99002 --- /dev/null +++ b/old-source/lapbayar.php @@ -0,0 +1,358 @@ + + + + + Cleopatra + + + + + + + + + + + +"; + echo "div#divprint{width:950px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:880px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:80px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + $kodesupp = $_POST['kdsupp']; + + if(bukaKoneksi()){ + global $conn; + ?> +
+ 0){ + mysqli_stmt_bind_result($stmt,$faktur,$tglMsk,$tglNota,$tglTmp,$kdSup,$nmSup,$ttBeli,$ttRp,$ket); + + print("
"); + print("

Rekap Pembelian Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("TANGGAL NOTA : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."


"); + print(""); + print(" + "); + + $ttHP = 0; + while(mysqli_stmt_fetch($stmt)){ + $ttHP += $ttRp; + print(" + + + + + "); + ?> + + + + + "); + print("
No. FakturTanggal MasukTanggal NotaTanggal Jt TempoKode Supp.Nama SupplierJumlah PembelianRupiah PembelianKeteranganPelunasan
.$faktur".encTgl($tglMsk)."".encTgl($tglNota)."".encTgl($tglTmp).".$kdSup$nmSup".number_format($ttBeli,0,',','.')."".number_format($ttRp,0,',','.')."$ket +
Total HP Pembelian".number_format($ttHP,0,',','.')."

"); + print("
"); + }else{ + echo "tidak ada data pembelian"; + echo "
"; + } + } + if (!empty($kodesupp)){ + /*----------------------------------------Retur grouping per supplier*/ + $query2 = "SELECT m.no_nota,m.tgl_retur,m.keterangan,m.kd_supplier,u.nama_supplier, + sum( d.jumlah ) jum,sum(d.jumlah*d.harga_satuan) hp + FROM d_retur_beli d, m_retur_beli m, supplier u,barang b + WHERE d.id_retur = m.id_retur + AND b.kode_barang = d.kd_barang + AND u.kd_supplier = m.kd_supplier + AND m.tgl_retur BETWEEN '$startDate' AND '$endDate' + AND m.kd_supplier = '$kodesupp' + AND m.validasi = '1' + AND m.status_bayar = '0' + GROUP BY m.no_nota + ORDER BY m.tgl_retur"; + } + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$nota,$tglretur,$ketr,$kdsupplier,$nmsupplier,$jmlret,$rpret); + + print("
"); + print("

Rekap Retur Per Supplier



"); + print("
TOKO ".$_SESSION['namatoko']."
"); + print("TANGGAL MASUK : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."


"); + print(""); + print(" + + "); + + $ttHP2 = 0; + while(mysqli_stmt_fetch($stmt2)){ + $ttHP2 += $rpret; + print(""); + ?> + + + "); + print("
No.NotaTgl ReturKode Supp.Nama SupplierJumlah ReturRupiah ReturKeteranganPelunasan
.$nota".encTgl($tglretur)."$kdsupplier$nmsupplier$jmlret".number_format($rpret,0,',','.')."$ketr +
Total HP Retur".number_format($ttHP2,0,',','.')."

"); + print("
"); + }else{ + echo "tidak ada data retur"; + echo "
"; + } + } + +?> + +
+

Form Pembayaran



+
+ + + + + + + + + + + " /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Periode Tgl Faktur:
Tgl Pembayaran:
Supplier:
Jenis Pembayaran: +
: + +
: +
Total Pembelian - Retur: + + + + +
+
+
+ Penyesuaian +
Diskon: Rp.
Penyesuaian: Rp.
Materai: Rp.
+
+
Total Pembayaran Supplier: + +
+ +
+ +
+ + +

"); + } + +?> diff --git a/old-source/lapbayarpersup.php b/old-source/lapbayarpersup.php new file mode 100644 index 0000000..fc275f3 --- /dev/null +++ b/old-source/lapbayarpersup.php @@ -0,0 +1,82 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Pembayaran Rinci Per Supplier +
+
+
+ + +
Range Tanggal: s/d
+
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/old-source/lapbayarpersupp.php b/old-source/lapbayarpersupp.php new file mode 100644 index 0000000..6f227d3 --- /dev/null +++ b/old-source/lapbayarpersupp.php @@ -0,0 +1,154 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:700px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + + if(bukaKoneksi()){ + global $conn; + + /*----------------------------------------Laporan pembayaran per supplier*/ + $query = "SELECT + s.kd_supplier,nama_supplier,a.jenis_bayar,a.totalbayartunai,b.totalbayargiro, c.totalbayartransfer + FROM + supplier s + LEFT JOIN + (SELECT kd_supplier,jenis_bayar,tgl_bayar,SUM(total_bayar)totalbayartunai FROM bayar WHERE jenis_bayar = 'cash' AND kd_supplier != '' AND DATE(tgl_cair) BETWEEN '$startDate' AND '$endDate' GROUP BY kd_supplier)a + ON s.`kd_supplier` = a.kd_supplier + LEFT JOIN + (SELECT kd_supplier,SUM(total_bayar)totalbayargiro FROM bayar WHERE jenis_bayar = 'giro' AND kd_supplier != '' AND DATE(tgl_cair) BETWEEN '$startDate' AND '$endDate' GROUP BY kd_supplier)b + ON s.kd_supplier = b.kd_supplier + LEFT JOIN + (SELECT kd_supplier,SUM(total_bayar)totalbayartransfer FROM bayar WHERE jenis_bayar = 'transfer' AND kd_supplier != '' AND DATE(tgl_cair) BETWEEN '$startDate' AND '$endDate' GROUP BY kd_supplier)c + ON s.kd_supplier = c.kd_supplier + where a.totalbayartunai is not null + or b.totalbayargiro is not null + or c.totalbayartransfer is not null"; + + + + + + // "SELECT b.kd_supplier,b.jenis_bayar,s.nama_supplier,b.tgl_bayar,b.total_bayar from bayar b + // join + // supplier s on b.kd_supplier=s.kd_supplier + // where b.kd_supplier != '' AND tgl_bayar BETWEEN '$startDate' AND '$endDate' group by tgl_bayar order by kd_supplier,tgl_bayar,jenis_bayar"; + + + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kd_supplier,$namasupp,$jnsbyr,$totalbayartunai,$totalbayargiro,$totalbayartransfer); + //mysqli_stmt_bind_result($stmt,$kd_supplier,$jnsbyr,$namasupp,$tgl_bayar,$totalbyr); + + print("
"); + print("

Laporan Jumlah Pembayaran Berdasarkan Jenis Bayar per Supplier


"); + print("PADA TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."

"); + /*iprint("
TOKO ".$_SESSION['namatoko']."
"); + print("TANGGAL MASUK : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."


");*/ + print(""); + print(" + "); + + $ttHP = 0; + $totalbyrtunai=0; + $totalbyrgiro=0; + $totalbyrtransfer=0; + while(mysqli_stmt_fetch($stmt)){ + + IF($kd_supplier != ""){ + print(""); + $totalbyrtunai+=$totalbayartunai; + $totalbyrgiro+=$totalbayargiro; + $totalbyrtransfer+=$totalbayartransfer; + } + + // } + /*if($kd_supplier != ""){ + IF($jnsbyr == "cash" ){ + + print(""); + $totalbyrtunai+=$totalbyr; + } + + IF($jnsbyr == "giro"){ + print(""); + $totalbyrgiro+=$totalbyr; + } + + IF($jnsbyr == "transfer" ){ + print(""); + $totalbyrtransfer+=$totalbyr; + } + + }*/ + + //} + + + + /* if($kd_supplier != ""){ + IF($jnsbyr == "cash" ){ + + print(""); + //$totalbyrtunai+=$totalbayartunai; + $totalbyrtunai+=intval($totalbayartunai); + + } + + IF($jnsbyr == "giro"){ + print(""); + //$totalbyrgiro+=$totalbayargiro; + $totalbyrgiro+=intval($totalbayargiro); + } + + IF($jnsbyr == "transfer"){ + print(""); + $totalbyrtransfer+=$totalbayartransfer; + //$totalbyrtransfer+=intval($totalbayartransfer); + + } + + } */ + + } + + + print(""); + + + /*print("");*/ + print("
Kode SupplierNama SupplierTotal Bayar TunaiTotal Bayar GiroTotal Bayar Transfer
$kd_supplier$namasupp".number_format($totalbayartunai,0,',','.')."".number_format($totalbayargiro,0,',','.')."".number_format($totalbayartransfer,0,',','.')."
$kd_supplier$namasupp$tgl_bayar".number_format($totalbyr,0,',','.')."".number_format(0,0,',','.')."".number_format(0,0,',','.')."
$kd_supplier$namasupp$tgl_bayar".number_format(0,0,',','.')."".number_format($totalbyr,0,',','.')."".number_format(0,0,',','.')."
$kd_supplier$namasupp$tgl_bayar".number_format(0,0,',','.')."".number_format(0,0,',','.')."".number_format($totalbyr,0,',','.')."
$kd_supplier$namasupp".number_format($totalbayartunai,0,',','.')."".number_format($totalbayargiro,0,',','.')."".number_format($totalbayartransfer,0,',','.')."
$kd_supplier$namasupp".number_format($totalbayargiro,0,',','.')."".number_format($totalbayargiro,0,',','.')."".number_format($totalbayartransfer,0,',','.')."
$kd_supplier$namasupp".number_format($totalbayartransfer,0,',','.')."".number_format($totalbayargiro,0,',','.')."".number_format($totalbayartransfer,0,',','.')."
Sub Total".number_format($totalbyrtunai, 0, ",", ".")."".number_format($totalbyrgiro, 0, ",", ".")."".number_format($totalbyrtransfer, 0, ",", ".")."
Total Pembayaran".number_format($ttHP,0,',','.')."

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } +} +?> diff --git a/old-source/laprincbayarpersupp.php b/old-source/laprincbayarpersupp.php new file mode 100644 index 0000000..1ccf1e4 --- /dev/null +++ b/old-source/laprincbayarpersupp.php @@ -0,0 +1,117 @@ +"; + echo "div#divprint{width:850px; border:1px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:700px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $startDate = decTgl($_POST['startDate']); + $endDate = decTgl($_POST['endDate']); + + + if(bukaKoneksi()){ + global $conn; + + /*----------------------------------------Laporan pembayaran per supplier*/ + $query = /*"SELECT + a.kd_supplier,a.jenis_bayar,nama_supplier,a.tgl_bayar,a.totalbayartunai,b.totalbayargiro, c.totalbayartransfer + FROM + supplier s + LEFT JOIN + (SELECT kd_supplier,jenis_bayar,tgl_bayar,total_bayar as totalbayartunai FROM bayar WHERE jenis_bayar = 'cash' AND kd_supplier != '' AND tgl_bayar BETWEEN '$startDate' AND '$endDate' order by jenis_bayar,tgl_bayar)a + ON s.`kd_supplier` = a.kd_supplier + LEFT JOIN + (SELECT kd_supplier,tgl_bayar,total_bayar as totalbayargiro FROM bayar WHERE jenis_bayar = 'giro' AND kd_supplier != '' AND tgl_bayar BETWEEN '$startDate' AND '$endDate' order by jenis_bayar,tgl_bayar)b + ON s.kd_supplier = b.kd_supplier + LEFT JOIN + (SELECT kd_supplier,tgl_bayar,total_bayar as totalbayartransfer FROM bayar WHERE jenis_bayar = 'transfer' AND kd_supplier != '' AND tgl_bayar BETWEEN '$startDate' AND '$endDate'order by jenis_bayar,tgl_bayar)c + ON s.kd_supplier = c.kd_supplier";*/ + + "SELECT b.kd_supplier,b.jenis_bayar,s.nama_supplier,b.tgl_cair,b.total_bayar from bayar b + join + supplier s on b.kd_supplier=s.kd_supplier + where b.kd_supplier != '' AND date(tgl_cair) BETWEEN '$startDate' AND '$endDate' + order by tgl_cair,kd_supplier,jenis_bayar"; + + + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + /*mysqli_stmt_bind_result($stmt,$kd_supplier,$jnsbyr,$namasupp,$tgl_bayar,$totalbayartunai,$totalbayargiro,$totalbayartransfer);*/ + mysqli_stmt_bind_result($stmt,$kd_supplier,$jnsbyr,$namasupp,$tgl_cair,$totalbyr); + + print("
"); + print("

Laporan Jumlah Pembayaran Rinci per Jenis Bayar per Supplier


"); + print("PADA TANGGAL : ".encTgl($startDate) ." s/d ".encTgl($endDate)."

"); + /*iprint("
TOKO ".$_SESSION['namatoko']."
"); + print("TANGGAL MASUK : ".encTgl($startDate) ." s/d ".encTgl($endDate)."
"); + print("DICETAK TANGGAL : ".date('d-m-Y')." ". date('H:i:s')."


");*/ + print(""); + print(" + "); + + $ttHP = 0; + $totalbyrtunai=0; + $totalbyrgiro=0; + $totalbyrtransfer=0; + while(mysqli_stmt_fetch($stmt)){ + $ttHP += $hp; + /* IF($kd_supplier != ""){ + print(""); + } + + }*/ + if($kd_supplier != ""){ + IF($jnsbyr == "cash" ){ + + print(""); + $totalbyrtunai+=$totalbyr; + } + + IF($jnsbyr == "giro"){ + print(""); + $totalbyrgiro+=$totalbyr; + } + + IF($jnsbyr == "transfer" ){ + print(""); + $totalbyrtransfer+=$totalbyr; + } + + } + + } + + //$ttjmlh=sum($totalbyr); + print(""); + + + /*print("");*/ + print("
Tanggal BayarKode SupplierNama SupplierTotal Bayar TunaiTotal Bayar GiroTotal Bayar Transfer
$kd_supplier$namasupp$tgl_bayar".number_format($totalbayartunai,0,',','.')."".number_format($totalbayargiro,0,',','.')."".number_format($totalbayartransfer,0,',','.')."
$tgl_cair$kd_supplier$namasupp".number_format($totalbyr,0,',','.')."".number_format(0,0,',','.')."".number_format(0,0,',','.')."
$tgl_cair$kd_supplier$namasupp".number_format(0,0,',','.')."".number_format($totalbyr,0,',','.')."".number_format(0,0,',','.')."
$tgl_cair$kd_supplier$namasupp".number_format(0,0,',','.')."".number_format(0,0,',','.')."".number_format($totalbyr,0,',','.')."
Sub Total".number_format($totalbyrtunai, 0, ",", ".")."".number_format($totalbyrgiro, 0, ",", ".")."".number_format($totalbyrtransfer, 0, ",", ".")."
Total Pembayaran".number_format($ttHP,0,',','.')."

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } +} +?> diff --git a/old-source/login.php b/old-source/login.php new file mode 100644 index 0000000..261395a --- /dev/null +++ b/old-source/login.php @@ -0,0 +1,37 @@ +query("SELECT * FROM karyawan WHERE username='$user' AND password='$pass'"); +if($perintah->num_rows > 0) { + + while($row = $perintah->fetch_array(MYSQLI_ASSOC)) { + + $updatelogin = $mysqli->query("UPDATE karyawan SET last_login = now() WHERE username='$user' AND password='$pass'"); +// session_register("useracc"); +// session_register("nik"); +// session_register("job"); +// session_register("validUser"); +// session_register("namatoko"); + $_SESSION["useracc"]=$row['username']; + $_SESSION["nik"]=$row['nik']; + $_SESSION["job"]=$row['id_pekerjaan']; + $_SESSION["namatoko"] = getNmToko($user,$pass); + $_SESSION["validUser"] = TRUE; + header("location:./pelanggan.php"); + + } + +}else{ + + header("location:./index.php"); + exit(); +} + +?> diff --git a/old-source/logout.php b/old-source/logout.php new file mode 100644 index 0000000..3d898f7 --- /dev/null +++ b/old-source/logout.php @@ -0,0 +1,20 @@ +alert('$message');"; + echo ""; + +?> diff --git a/old-source/menu.php b/old-source/menu.php new file mode 100644 index 0000000..c0e3eb8 --- /dev/null +++ b/old-source/menu.php @@ -0,0 +1,133 @@ + + + + + +
+ +
diff --git a/old-source/pelanggan.php b/old-source/pelanggan.php new file mode 100644 index 0000000..8f65238 --- /dev/null +++ b/old-source/pelanggan.php @@ -0,0 +1,270 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Pelanggan Baru +
+ + query("SELECT kd_customer FROM pelanggan ORDER BY kd_customer DESC limit 1"); + $dt = $data->fetch_array(MYSQLI_ASSOC); + $nourut = $dt['kd_customer']; + $nourut++; + + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Kode Pelanggan: + + + +
No.KTP: *
Nama: * +
Jenis Kelamin: + +
Tempat Tanggal Lahir: , + +
Status Nikah: + +
Agama: + +
Alamat: *
Wilayah: kelurahan,kecamatan,kabupaten,propinsi
Telepon:
HP:
E-mail:
Jenis Pelanggan: + +
Pekerjaan: + +
Upline: +
Nilai BON:
Batas BON:
Batas BON Istimewa:
Komisi:
Komisi yang diambil:

+ + +
+
+
+ +
+ close(); ?> + +
+
Cari Pelanggan
+
+
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+
+ +
+ +
+
Cari Pelanggan
+
+
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+
+ +
+ + diff --git a/old-source/plgjobkosong.php b/old-source/plgjobkosong.php new file mode 100644 index 0000000..66668b6 --- /dev/null +++ b/old-source/plgjobkosong.php @@ -0,0 +1,78 @@ + + + + Pelanggan + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Pelanggan yg jenis pekerjaannya kosong + "; + echo "div#divprint{width:900px; border:0px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:850px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:10pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $stmt = $mysqli->query("SELECT p.`kd_customer`, p.`nama`, p.`alamat`, p.`kd_lokasi`, p.`telp` FROM pelanggan p where pekerjaan = '' or pekerjaan = '-' or pekerjaan is null"); + if($stmt->num_rows > 0) { + print("
"); + print(""); + print(""); + + while($a = $stmt->fetch_array(MYSQLI_ASSOC)) { + $kd_customer = $a['kd_customer']; + $nama = $a['nama']; + $alamat = $a['alamat']; + $wilayah = $a['wilayah']; + $telp = $a['telp']; + + print(""); + } + print("
Kode PelangganNamaAlamatWilayahTelp
$kd_customer$nama$alamat$wilayah$telp

"); + print("
"); + + $stmt->close(); + } + $mysqli->close(); + ?> +
+
+ +
+ + + + +?> \ No newline at end of file diff --git a/old-source/plgperjnspekerjaan.php b/old-source/plgperjnspekerjaan.php new file mode 100644 index 0000000..9fbe1d0 --- /dev/null +++ b/old-source/plgperjnspekerjaan.php @@ -0,0 +1,94 @@ + + + + Pelanggan + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Report Pelanggan + "; + echo "div#divprint{width:900px; border:0px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:850px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:10pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + require_once 'db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $stmt = $mysqli->query("select pekerjaan, + case pekerjaan + when 1 then 'Ibu Rumah Tangga' + when 2 then 'Profesional' + when 3 then 'TNI / POLRI' + when 4 then 'Guru / Dosen' + when 5 then 'Karyawan / Staf BUM Swasta' + when 6 then 'Buruh' + when 7 then 'Pensiunan / Purnawirawan' + when 8 then 'Pegawai Negeri Sipil' + when 9 then 'Pelajar / Mahasiswa' + when 10 then 'Wiraswasta' + when 11 then 'Belum / Tidak Bekerja' + when 12 then 'Karyawan / Staf BUMN / BUMD' + when 13 then 'Pejabat Pemerintah' + when 14 then 'Rohaniawan' + when 15 then 'Seniman' + end as jns_pekerjaan, count(*) jml + from pelanggan + group by pekerjaan + order by jns_pekerjaan"); + if($stmt->num_rows > 0) { + print("
"); + print(""); + print(""); + + while($a = $stmt->fetch_array(MYSQLI_ASSOC)) { + $id_pekerjaan = $a['jns_pekerjaan']; + $juml = $a['jml']; + + print(""); + } + print("
Jenis PekerjaanJumlah
$id_pekerjaan$juml

"); + print("
"); + + $stmt->close(); + } + $mysqli->close(); + ?> +
+
+ +
+ + + + +?> \ No newline at end of file diff --git a/old-source/poinplg.php b/old-source/poinplg.php new file mode 100644 index 0000000..6116bff --- /dev/null +++ b/old-source/poinplg.php @@ -0,0 +1,58 @@ + + + + Pelanggan + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ + + +
Kode Pelanggan:
+
+
+
+ +
+ +
+ + + diff --git a/old-source/proses_lini.php b/old-source/proses_lini.php new file mode 100644 index 0000000..237333a --- /dev/null +++ b/old-source/proses_lini.php @@ -0,0 +1,24 @@ + + + + + + + + + + + +
+
diff --git a/old-source/proses_negara.php b/old-source/proses_negara.php new file mode 100644 index 0000000..874b203 --- /dev/null +++ b/old-source/proses_negara.php @@ -0,0 +1,18 @@ + diff --git a/old-source/proses_supp.php b/old-source/proses_supp.php new file mode 100644 index 0000000..2cb3f3c --- /dev/null +++ b/old-source/proses_supp.php @@ -0,0 +1,21 @@ + diff --git a/old-source/purchase.php b/old-source/purchase.php new file mode 100644 index 0000000..4c817a7 --- /dev/null +++ b/old-source/purchase.php @@ -0,0 +1,259 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Data Pengadaan Barang +
+ + + + + + + + + + + + + + + +
Nomor Faktur: + + + Tanggal Nota: Tanggal Jatuh Tempo: *
Kode Supplier: + + User: " readonly />* perhitungan berdasarkan tgl nota
Status + : +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Barcode: *ID Barang: + +
Nama barang: * +
Group Product: + +
Sub Group Product: + +
Hrg Pokok Lama: Pcs Max II: Pcs Max III:
Hrg Jual Lama: Harga Jual II: Harga Jual III:
Satuan: + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Jumlah Beli: * Diskon %: % PPN: Hrg Pokok Baru: Expired Date: +
Sub Total: * Diskon Rp: % Profit: Hrg Jual Baru:
+
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+
Cari barang
+
+
+
+ + + + +
Barcode/Nama Brg:
+
+
+ Hasil pencarian +
+
+
+
+ +
+ + + diff --git a/old-source/rak.php b/old-source/rak.php new file mode 100644 index 0000000..00cf693 --- /dev/null +++ b/old-source/rak.php @@ -0,0 +1,92 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Rak +
+ + + + + + + + + + + +
ID Rak: + + + + +
Nama Rak: + +

+ +
+
+
+ +
+ +
+
Cari Rak
+
+ +
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + diff --git a/old-source/report_profitperjnspekerjaan.php b/old-source/report_profitperjnspekerjaan.php new file mode 100644 index 0000000..74ece99 --- /dev/null +++ b/old-source/report_profitperjnspekerjaan.php @@ -0,0 +1,70 @@ + + + + Cleopatra + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ + +
Range Tanggal: s/d
+
+
+
+ +
+ +
+ + + diff --git a/old-source/report_profitperplg.php b/old-source/report_profitperplg.php new file mode 100644 index 0000000..209a4da --- /dev/null +++ b/old-source/report_profitperplg.php @@ -0,0 +1,70 @@ + + + + Cleopatra + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ + +
Range Tanggal: s/d
+
+
+
+ +
+ +
+ + + diff --git a/old-source/report_transaksiperjnspekerjaan.php b/old-source/report_transaksiperjnspekerjaan.php new file mode 100644 index 0000000..0bc4f33 --- /dev/null +++ b/old-source/report_transaksiperjnspekerjaan.php @@ -0,0 +1,70 @@ + + + + Cleopatra + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ + +
Range Tanggal: s/d
+
+
+
+ +
+ +
+ + + diff --git a/old-source/retur_beli (copy)/ambil_barang.php b/old-source/retur_beli (copy)/ambil_barang.php new file mode 100644 index 0000000..2918d10 --- /dev/null +++ b/old-source/retur_beli (copy)/ambil_barang.php @@ -0,0 +1,51 @@ +query("SELECT brg.kode_barang,brg.kode_supplier,d.no_faktur,d.kode_asli,brg.nama_barang,n.harga_pokok, n.harga_jual, n.stok, n.nomor + FROM barang brg inner join no_barang n on brg.id_gabungan = n.id_gabungan,d_pembelian d + WHERE n.nomor = '$_REQUEST[nobarang]' + AND (brg.kode_barang = '$_REQUEST[idbarang]' OR brg.kode_lama = '$_REQUEST[idbarang]') + AND (d.kode_barang = brg.kode_barang AND d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + AND n.stok > 0 + ORDER BY brg.kode_barang,n.nomor"); + } else if(!isset($_REQUEST['nobarang'])) + { + $data = $mysqli->query("SELECT brg.kode_barang,brg.kode_supplier,d.no_faktur,d.kode_asli,brg.nama_barang,n.harga_pokok, n.harga_jual, n.stok, n.nomor + FROM barang brg inner join no_barang n on brg.id_gabungan = n.id_gabungan,d_pembelian d + WHERE (brg.kode_barang = '$_REQUEST[idbarang]' OR brg.kode_lama = '$_REQUEST[idbarang]') + AND (brg.kode_barang = d.kode_barang AND d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + AND n.stok > 0 + ORDER BY brg.kode_barang,n.nomor"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'],'kode_supp' => $a['kode_supplier'],'no_faktur' => $a['no_faktur'],'kode_asli' => $a['kode_asli'],'nama_barang' => $a['nama_barang'], + 'harga_beli' => $a['harga_pokok'],'harga_jual' => $a['harga_jual'], 'stok' => $a['stok'], 'nomor_barang' => $a['nomor'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/retur_beli (copy)/ambil_barang_kembali.php b/old-source/retur_beli (copy)/ambil_barang_kembali.php new file mode 100644 index 0000000..a6a95fb --- /dev/null +++ b/old-source/retur_beli (copy)/ambil_barang_kembali.php @@ -0,0 +1,49 @@ +query("SELECT brg.kode_barang,brg.kode_supplier,d.no_faktur,d.kode_asli,brg.nama_barang,n.harga_pokok, n.harga_jual, n.stok, n.nomor + FROM barang brg inner join no_barang n on brg.id_gabungan = n.id_gabungan,d_pembelian d + WHERE n.nomor = '$_REQUEST[nobarang]' + AND brg.kode_barang = '$_REQUEST[idbarang]' + AND (d.kode_barang = brg.kode_barang AND d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + ORDER BY brg.kode_barang,n.nomor"); + } else if(!isset($_REQUEST['nobarang'])) + { + $data = $mysqli->query("SELECT brg.kode_barang,brg.kode_supplier,d.no_faktur,d.kode_asli,brg.nama_barang,n.harga_pokok, n.harga_jual, n.stok, n.nomor + FROM barang brg inner join no_barang n on brg.id_gabungan = n.id_gabungan,d_pembelian d + WHERE brg.kode_barang = '$_REQUEST[idbarang]' + AND (brg.kode_barang = d.kode_barang AND d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + ORDER BY brg.kode_barang,n.nomor"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'],'kode_supp' => $a['kode_supplier'],'no_faktur' => $a['no_faktur'],'kode_asli' => $a['kode_asli'],'nama_barang' => $a['nama_barang'], + 'harga_beli' => $a['harga_pokok'],'harga_jual' => $a['harga_jual'], 'stok' => $a['stok'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/retur_beli (copy)/ambil_kode_barang.php b/old-source/retur_beli (copy)/ambil_kode_barang.php new file mode 100644 index 0000000..c918f36 --- /dev/null +++ b/old-source/retur_beli (copy)/ambil_kode_barang.php @@ -0,0 +1,53 @@ +query("SELECT DISTINCT d.kode_barang, m.kd_supplier, b.nama_barang, sup.nama_supplier, + m.tgl_nota, m.tgl_masuk, m.tgl_jatuh_tempo, m.status, m.keterangan, m.nik + FROM m_pembelian m, d_pembelian d, barang b, supplier sup, no_barang n + WHERE m.no_faktur = d.no_faktur + AND d.kode_barang = b.kode_barang + AND b.id_gabungan = n.id_gabungan + AND m.kd_supplier = sup.kd_supplier + AND n.stok > 0 + AND m.no_faktur='$_REQUEST[nofaktur]' + ORDER BY d.kode_barang"); + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + $jdata = $mysqli->query("SELECT count(*) + FROM m_pembelian m, d_pembelian d, barang b, supplier sup, no_barang n + WHERE m.no_faktur = d.no_faktur + AND d.kode_barang = b.kode_barang + AND b.id_gabungan = n.id_gabungan + AND m.kd_supplier = sup.kd_supplier + AND n.stok > 0 + AND m.no_faktur='$_REQUEST[nofaktur]'"); + $j = $jdata->fetch_array(MYSQL_NUM); + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'], 'kd_supplier' => $a['kd_supplier'], + 'nama_barang' => $a['nama_barang'], 'supplier' => $a['nama_supplier'], + 'tglnota' => $a['tgl_nota'],'tglmasuk' => $a['tgl_masuk'],'tgljthtempo' => $a['tgl_jatuh_tempo'], + 'status' => $a['status'],'keterangan' => $a['keterangan'],'nik' => $a['nik'], + 'jdata' => $j[0] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/retur_beli (copy)/ambil_nomor.php b/old-source/retur_beli (copy)/ambil_nomor.php new file mode 100644 index 0000000..b5c6157 --- /dev/null +++ b/old-source/retur_beli (copy)/ambil_nomor.php @@ -0,0 +1,36 @@ +query("SELECT DISTINCT nomor FROM d_pembelian WHERE kode_barang='$_REQUEST[idbarang]' ORDER BY nomor"); + $data = $mysqli->query("SELECT n.nomor FROM d_pembelian d, no_barang n, barang b + WHERE (b.kode_barang ='$_REQUEST[idbarang]' OR b.kode_lama = '$_REQUEST[idbarang]') + AND b.id_gabungan = n.id_gabungan + AND (d.kode_barang = b.kode_barang and d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + AND n.stok > 0 + ORDER BY nomor"); + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_NUM)) + { + $harray[$idx] = array('nomor' => $a[0]); + $idx++; + } + } + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/retur_beli (copy)/cari_nota.php b/old-source/retur_beli (copy)/cari_nota.php new file mode 100644 index 0000000..cd4d735 --- /dev/null +++ b/old-source/retur_beli (copy)/cari_nota.php @@ -0,0 +1,94 @@ +query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur != "" && $tglawal != "" && $tglakhir != "" && $kdsup == "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur != "" && $tglawal == "" && $tglakhir == "" && $kdsup != "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur != "" && $tglawal == "" && $tglakhir == "" && $kdsup == "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur == "" && $tglawal != "" && $tglakhir != "" && $kdsup != "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur == "" && $tglawal != "" && $tglakhir != "" && $kdsup == "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur == "" && $tglawal == "" && $tglakhir == "" && $kdsup != "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + + $harray[$idx] = array( + 'no_faktur' => $a['no_faktur'], 'tgl_nota' => substr($a['tgl_nota'],8,2)."-".substr($a['tgl_nota'],5,2)."-".substr($a['tgl_nota'],0,4), 'rp_beli' => $a['rp_beli'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/retur_beli (copy)/fungsi_retur.php b/old-source/retur_beli (copy)/fungsi_retur.php new file mode 100644 index 0000000..9bd5d44 --- /dev/null +++ b/old-source/retur_beli (copy)/fungsi_retur.php @@ -0,0 +1,567 @@ + ".$nofaktur; + $stmt = $mysqli->prepare("INSERT INTO m_pembelian VALUES (?, now(), now(), '-', now(), ?, 'T', 0, ?, ?, 0, '1', '$ket', now(), ?, ?)"); + $stmt->bind_param("sssiss", $norhp, $kd_supplier, $nik, $rpbeli, $nofaktur, $statusrvb); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} + +function insert_d_pembelian($norhp, $kode_barang, $kode_lama, $nomor, $stok, $stokrev, $hplama, $hjlama, $hpbaru, $hjbaru, $nama, $idgabungan) +{ + $hasil = FALSE; + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if(!mysqli_connect_errno()) + { + for ($i = 0; $i < count($kode_barang); $i++) + { + /* insert data lama */ + $hplm = decode_hp($hplama[$i]); + $profitlama = ceil((($hjlama[$i] - $hplm) / $hplm) * 100); + $stoklama = -1 * $stok[$i]; + $faktur_asli = get_kode_faktur_asli($kode_barang[$i]); + $stmt = $mysqli->prepare("INSERT INTO d_pembelian(no_faktur, kode_barang, kode_baranglama, nomor, jumlah, harga_satuan, harga_pokok, harga_jual, profit, kode_asli, jum_fisik, jenis, lokasi, hj_final, nm_brg) + VALUES (?, ?, ?, ?, ?, 0, ?, ?, ?, '-', ?, 'S', '1A', ?, ?)"); + $stmt->bind_param("ssssisiiiis", $norhp, $kode_barang[$i], $kode_lama[$i], $nomor[$i], $stoklama, $hplama[$i], $hjlama[$i], $profitlama, $stoklama, $hjlama[$i], $nama[$i]); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + + /* insert data baru */ + if ($hasil) + { + $hpbr = decode_hp($hpbaru[$i]); + $profitbaru = ceil((($hjbaru[$i] - $hpbr) / $hpbr) * 100); + $stmt = $mysqli->prepare("INSERT INTO d_pembelian(no_faktur, kode_barang, kode_baranglama, nomor, jumlah, harga_satuan, harga_pokok, harga_jual, profit, kode_asli, jum_fisik, jenis, lokasi, hj_final, nm_brg) + VALUES (?, ?, ?, ?, ?, 0, ?, ?, ?, '-', ?, 'S', '1A', ?, ?)"); + $stmt->bind_param("ssssisiiiis", $norhp, $kode_barang[$i], $kode_lama[$i], $nomor[$i], $stokrev[$i], $hpbaru[$i], $hjbaru[$i], $profitbaru, $stokrev[$i], $hjbaru[$i], $nama[$i]); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* update barang*/ + if ($hasil) + { + $update2 = update_barang($idgabungan[$i], $nama[$i]); + if($update2) + { + $hasil = TRUE; + } else + { + $hasil = FALSE; + } + } + + /* update no_barang*/ + if ($hasil) + { + $update = update_no_barang($idgabungan[$i], $nomor[$i], $hpbaru[$i], $hjbaru[$i], $stokrev[$i]); + if($update) + { + $hasil = TRUE; + } else + { + $hasil = FALSE; + } + } + $faktur_asli = ""; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} + +/** + * + * @param $id + * @param $nomor + * @param $hp + * @param $hj + * @return unknown_type + */ +function update_no_barang($id, $nomor, $hp, $hj, $stokrev) +{ + $hasil = FALSE; + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if(!mysqli_connect_errno()) + { + // isi table master + $stmt = $mysqli->prepare("UPDATE no_barang SET stok = ?,harga_pokok = ?, harga_jual = ? WHERE id_gabungan = ? AND nomor = ?"); + $stmt->bind_param("isiss", $stokrev, $hp, $hj, $id, $nomor); + $stmt->execute(); + if($stmt->affected_rows >= 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} + +function update_barang($id, $nama) +{ + $hasil = FALSE; + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if(!mysqli_connect_errno()) + { + // isi table master + $stmt = $mysqli->prepare("UPDATE barang SET nama_barang = ? WHERE id_gabungan = ?"); + $stmt->bind_param("ss", $nama, $id); + $stmt->execute(); + if($stmt->affected_rows >= 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} +/** + * + * @param $kdsupplier + * @return unknown_type + */ +function get_no_rhp($kdsupplier) +{ + $urutbaru = 0; + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + // cek ada atau tidak + if(cek_data($kdsupplier)) + { + $data_faktur = $mysqli->query("SELECT MAX(RIGHT(no_faktur, 3)) FROM m_pembelian WHERE LEFT(no_faktur, 10) = 'RVB-{$kdsupplier}'"); + if($data_faktur->num_rows > 0) + { + $urut = $data_faktur->fetch_array(); + $urutbaru = (int)$urut[0] + 1; + if(strlen($urutbaru) == 1) + { + $urutbaru = "00".$urutbaru; + } + if(strlen($urutbaru) == 2) + { + $urutbaru = "0".$urutbaru; + } + /* tutup hasil query */ + $data_faktur->close(); + } + } else + { + $urutbaru = "000"; + } + $hasil[0] = "RVB-".$kdsupplier."-".$urutbaru; + echo json_encode($hasil); + /* tutup koneksi */ + $mysqli->close(); +} + +/** + * + * @param $kodesupplier + * @return unknown_type + */ +function cek_data($kodesupplier) +{ + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + // cek ada atau tidak + $data = $mysqli->query("SELECT COUNT(*) FROM m_pembelian WHERE LEFT(no_faktur, 10) = 'RVB-{$kodesupplier}'"); + $dt = $data->fetch_array(); + if($dt[0] > 0) + { + return true; + } else + { + return false; + } + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); +} + +/** + * + * @param $kode + * @param $nomor + * @param $kd_supplier + * @return unknown_type + */ +function ambil_barang($kode, $nomor, $nofaktur) +{ + if($kode != "" || $nomor != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if($nomor != "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.kode_lama, brg.nama_barang, brg.id_gabungan, nb.stok, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, supplier s, d_pembelian dp + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND brg.kode_barang = '{$kode}' AND nb.nomor = '{$nomor}' + AND brg.kode_supplier = s.kd_supplier AND dp.no_faktur = '{$nofaktur}' LIMIT 1"); + } else if($nomor == "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.kode_lama, brg.nama_barang, brg.id_gabungan, nb.stok, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, supplier s, d_pembelian dp + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND brg.kode_barang = '{$kode}' + AND brg.kode_supplier = s.kd_supplier AND dp.no_faktur = '{$nofaktur}' LIMIT 1"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('kode_barang' => $a['kode_barang'], 'kode_lama' => $a['kode_lama'], 'nama_barang' => $a['nama_barang'], + 'supplier' => $a['nama_supplier'], 'id_gabungan' => $a['id_gabungan'], 'stok' => $a['stok'], + 'kd_supplier' => $a['kode_supplier'], 'hp' => $a['harga_pokok'], 'hj' => $a['harga_jual'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kode + * @param $nomor + * @param $kd_supplier + * @return unknown_type + */ +function cek_barang($kode, $nomor, $nofaktur) +{ + if($kode != "" || $nomor != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + + if($nomor != "") + { + $data = $mysqli->query("SELECT count(*) + FROM barang brg, no_barang nb, d_pembelian dp + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND brg.kode_barang = '{$kode}' AND nb.nomor = '{$nomor}' + AND dp.no_faktur = '{$nofaktur}'"); + } else if($nomor == "") + { + $data = $mysqli->query("SELECT count(*) + FROM barang brg + WHERE brg.kode_barang = '{$kode}'"); + } + if($data->num_rows > 0) + { + $jum = $data->fetch_array(); + if($jum[0] > 0) + { + $harray[0] = "true"; + } else + { + $harray[0] = "false"; + } + /* tutup hasil query */ + $data->close(); + } else + { + $harray[0] = "false"; + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kode + * @param $nama + * @param $kd_supplier + * @return unknown_type + */ +function cari_barang($kode, $nama) +{ + if($kode != "" || $nama != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + + if($nama != "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.nama_barang, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, d_pembelian dp, supplier s + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND brg.kode_supplier = s.kd_supplier + AND brg.nama_barang LIKE '%{$nama}%'"); + } else if($nama == "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.nama_barang, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, d_pembelian dp, supplier s + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang AND brg.kode_supplier = s.kd_supplier + AND (brg.kode_barang LIKE '{$kode}%' OR brg.kode_lama LIKE '{$kode}')"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'], 'nama_barang' => $a['nama_barang'], 'supplier' => $a['nama_supplier'], + 'kd_supplier' => $a['kode_supplier'], 'hp' => $a['harga_pokok'], 'hj' => $a['harga_jual'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kode + * @param $nama + * @return unknown_type + */ +function get_supplier($kode, $nama) +{ + if($kode != "" || $nama != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + + if($nama != "") + { + $data = $mysqli->query("SELECT s.kd_supplier, s.nama_supplier + FROM supplier s + WHERE s.kd_supplier LIKE '%{$kode}%' AND s.nama_supplier LIKE '%{$nama}%'"); + } else if($nama == "") + { + $data = $mysqli->query("SELECT s.kd_supplier, s.nama_supplier + FROM supplier s + WHERE s.kd_supplier LIKE '%{$kode}%'"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('kode_supplier' => $a['kd_supplier'], 'nama_supplier' => $a['nama_supplier']); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kodebarang + * @return unknown_type + */ +function get_kode_faktur_asli($kodebarang) +{ + $faktur = ""; + if($kodebarang != "" ) + { + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + + $data = $mysqli->query("SELECT d.no_faktur FROM d_pembelian d WHERE d.kode_barang = '{$kodebarang}'"); + if($data->num_rows > 0) + { + $faktur = $data->fetch_array(MYSQLI_NUM); + $faktur = $faktur[0]; + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + return $faktur; +} +/** + * + * @param $data + * @return unknown_type + */ +function hitung_total_hp($data, $stok) +{ + $total = 0; + for ($i = 0; $i < count($data); $i++) + { + $total += decode_hp($data[$i]) * $stok[$i]; + } + return $total; +} + +/** + * + * @param $hp + * @return int hasil decode + */ +function decode_hp($hp) +{ + $dt = ""; + for($i = 0; $i < strlen($hp); $i++) + { + $chr = substr($hp, $i, 1); + switch($chr) + { + case "B" : $dt .= "1";break; + case "R" : $dt .= "2";break; + case "A" : $dt .= "3";break; + case "W" : $dt .= "4";break; + case "N" : $dt .= "5";break; + case "F" : $dt .= "6";break; + case "O" : $dt .= "7";break; + case "X" : $dt .= "8";break; + case "E" : $dt .= "9";break; + case "S" : $dt .= "0";break; + } + } + return (int) $dt; +} +?> diff --git a/old-source/retur_beli (copy)/hmenu.php~ b/old-source/retur_beli (copy)/hmenu.php~ new file mode 100644 index 0000000..ed1d5c8 --- /dev/null +++ b/old-source/retur_beli (copy)/hmenu.php~ @@ -0,0 +1,128 @@ + diff --git a/old-source/retur_beli (copy)/menu.php b/old-source/retur_beli (copy)/menu.php new file mode 100644 index 0000000..bb01ae5 --- /dev/null +++ b/old-source/retur_beli (copy)/menu.php @@ -0,0 +1,138 @@ + + + + + +
+ +
diff --git a/old-source/retur_beli (copy)/retur_ambil_alasan.php b/old-source/retur_beli (copy)/retur_ambil_alasan.php new file mode 100644 index 0000000..1a6ef74 --- /dev/null +++ b/old-source/retur_beli (copy)/retur_ambil_alasan.php @@ -0,0 +1,28 @@ +query("SELECT DISTINCT(keterangan) FROM m_retur_beli"); +if($data->num_rows > 0) +{ + $idx = 0; + while($ket = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('keterangan' => $ket['keterangan']); + $idx += 1; + } + /* tutup hasil query */ + $data->close(); +} +/* tutup koneksi */ +$mysqli->close(); +/* cetak hasil */ +echo json_encode($harray); diff --git a/old-source/retur_beli (copy)/retur_ambil_barang.php b/old-source/retur_beli (copy)/retur_ambil_barang.php new file mode 100644 index 0000000..54fc25b --- /dev/null +++ b/old-source/retur_beli (copy)/retur_ambil_barang.php @@ -0,0 +1,45 @@ +query("SELECT b.kode_barang, b.kode_lama, n.nomor, b.nama_barang, b.kode_supplier, d.jumlah, d.harga_satuan, (d.jumlah * d.harga_satuan) as jum, m.no_nota, n.stok + FROM d_retur_beli d, m_retur_beli m, barang b, no_barang n + WHERE + b.id_gabungan = n.id_gabungan + AND d.id_retur = m.id_retur + AND (d.kd_barang = b.kode_barang AND d.nomor_barang = n.nomor) + AND d.id_retur = $idretur + ORDER BY b.kode_barang"); + /* tampung jumlah data dalam var hasil */ + if($data->num_rows > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('kd_barang' => $a['kode_barang'], 'kode_asli' => $a['kode_lama'], 'jumlah' => $a['jumlah'], 'nama_barang' => $a['nama_barang'], 'kode_supp' => $a['kode_supplier'], 'harga_satuan' => $a['harga_satuan'], 'nomor_barang' => $a['nomor'], 'no_nota' => $a['no_nota'], 'stokakh' => $a['stok']); + $idx++; + } + + /* tutup hasil query */ + $data->close(); + + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/retur_beli (copy)/retur_ambil_keterangan.php b/old-source/retur_beli (copy)/retur_ambil_keterangan.php new file mode 100644 index 0000000..69159fe --- /dev/null +++ b/old-source/retur_beli (copy)/retur_ambil_keterangan.php @@ -0,0 +1,33 @@ +query("SELECT mp.tgl_nota, mp.kd_supplier + FROM m_pembelian mp + WHERE no_faktur = '$_REQUEST[nonota]'"); + $data2 = $mysqli->query("SELECT SUM( jumlah ) FROM d_retur_beli WHERE id_retur = $_REQUEST[idretur] GROUP BY id_retur"); + if($data1->num_rows > 0 && $data2->num_rows > 0) + { + $ket = $data1->fetch_array(MYSQLI_ASSOC); + $jum = $data2->fetch_array(MYSQLI_NUM); + $harray = array('tgl_nota' => substr($ket['tgl_nota'],8,2)."-".substr($ket['tgl_nota'],5,2)."-".substr($ket['tgl_nota'],0,4), 'kd_supplier' => $ket['kd_supplier'], 'jumlah' => $jum[0]); + /* tutup hasil query */ + $data1->close(); + $data2->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); +} \ No newline at end of file diff --git a/old-source/retur_beli (copy)/retur_cari_nota.php b/old-source/retur_beli (copy)/retur_cari_nota.php new file mode 100644 index 0000000..bdb9085 --- /dev/null +++ b/old-source/retur_beli (copy)/retur_cari_nota.php @@ -0,0 +1,60 @@ +query("SELECT mr.id_retur, mr.no_nota, mr.tgl_retur, mr.keterangan, mr.total_retur, mr.nik, mr.kd_supplier, mr.jml_item + FROM m_retur_beli mr + WHERE mr.id_retur = '$nofaktur' + AND mr.tgl_retur BETWEEN '$tglawal' AND '$tglakhir' + AND mr.validasi = '$valid'"); + else if($nofaktur != "" && $tglawal == "" && $tglakhir == "") + $data = $mysqli->query("SELECT mr.id_retur, mr.no_nota, mr.tgl_retur, mr.keterangan, mr.total_retur, mr.nik, mr.kd_supplier, mr.jml_item + FROM m_retur_beli mr + WHERE mr.id_retur = '$nofaktur' + AND mr.validasi = '$valid'"); + else if($nofaktur == "" && $tglawal != "" && $tglakhir != "") + $data = $mysqli->query("SELECT mr.id_retur, mr.no_nota, mr.tgl_retur, mr.keterangan, mr.total_retur, mr.nik, mr.kd_supplier, mr.jml_item + FROM m_retur_beli mr + WHERE mr.tgl_retur BETWEEN '$tglawal' AND '$tglakhir' + AND mr.validasi = '$valid'"); + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'id_retur' => $a['id_retur'], 'no_nota' => $a['no_nota'], 'tgl_retur' => substr($a['tgl_retur'],8,2)."-".substr($a['tgl_retur'],5,2)."-".substr($a['tgl_retur'],0,4), + 'keterangan' => $a['keterangan'], 'total_retur' => $a['total_retur'], 'nik' => $a['nik'], 'kdsupp' => $a['kd_supplier'], 'jml_item' => $a['jml_item'], + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + + echo json_encode($harray); +} diff --git a/old-source/retur_beli (copy)/retur_fbaru.php b/old-source/retur_beli (copy)/retur_fbaru.php new file mode 100644 index 0000000..5e4efff --- /dev/null +++ b/old-source/retur_beli (copy)/retur_fbaru.php @@ -0,0 +1,233 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ Retur Pembelian - Baru + + + + + + + + + + + + + + + + +
Tanggal Retur: + + Kode Supplier:
No.Faktur Retur: NIK:
Total Retur: Keterangan: +   
Jumlah Item Retur:
+
+ + + + + + + + + + +
KODE BARANGBARCODENAMA BARANGHARGA SATUAN BELISTOK KOMPJML RETUR
+
+
+ + + +
+
+
+
+ +
+ + +
+

+
+ +
+

+
+ +
+ + + + + + + + + + + +
Nomor Faktur:
Rentang Tanggal: + s/d + +
Kode Supplier:
+
+ Hasil pencarian +
+
+
+ + +
+ + + + + + + + +
Kode Barang:
Nama Barang: + +
+
+ Hasil pencarian +
+
+
+ + + + + + + + + + diff --git a/old-source/retur_beli (copy)/retur_fedit.php b/old-source/retur_beli (copy)/retur_fedit.php new file mode 100644 index 0000000..0e230f2 --- /dev/null +++ b/old-source/retur_beli (copy)/retur_fedit.php @@ -0,0 +1,241 @@ + + + + + :: Pengadaan Barang + + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ Retur Pembelian - Edit + + + + + + + + + + + + + + + + + + + + + +
ID Retur: + + Kode Supplier:
Tanggal Retur: + NIK:
No.Faktur Retur: Keterangan: +   
Total Retur:
Jumlah Item Retur:
+
+ + + + + + + + + + + +
+
+ + + + + +
+
+
+
+ +
+ + +
+

+
+ +
+

+
+ +
+ + + + + + + + +
ID Retur:
Rentang Tanggal: + s/d + +
+
+ Hasil pencarian +
+
+
+ + + + + + + + diff --git a/old-source/retur_beli (copy)/retur_fprint.php b/old-source/retur_beli (copy)/retur_fprint.php new file mode 100644 index 0000000..dcef9f4 --- /dev/null +++ b/old-source/retur_beli (copy)/retur_fprint.php @@ -0,0 +1,214 @@ + + + + + :: Pengadaan Barang + + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ Retur Pembelian - Print + + + + + + + + + + + + + + + + + + + + + +
ID Retur: + + Kode Supplier:
Tanggal Retur: + NIK:
No.Faktur Retur: Keterangan:
Total Retur:
Jumlah Item Retur:
+
+ + + + + + + + + + +
+
+ +
+
+
+
+ +
+ + +
+

+
+ +
+

+
+ +
+ + + + + + + + +
ID Retur:
Rentang Tanggal: + s/d + +
+
+ Hasil pencarian +
+
+
+ + + + + + + diff --git a/old-source/retur_beli (copy)/retur_hapus.php b/old-source/retur_beli (copy)/retur_hapus.php new file mode 100644 index 0000000..ef60bad --- /dev/null +++ b/old-source/retur_beli (copy)/retur_hapus.php @@ -0,0 +1,30 @@ +prepare("DELETE FROM d_retur_beli WHERE id_retur = ? AND kd_barang = ? AND jumlah = ? AND harga_satuan = ? LIMIT 1"); + $stmt->bind_param("isii",$retur_id, $kode, $jumlah, $harga); + $stmt->execute(); + if($stmt->affected_rows > 0) $hasil = 1; + else $hasil = 0; + $stmt->close(); + } + $harray = array('hasil' => $hasil); + echo json_encode($harray); +} +/* end file */ diff --git a/old-source/retur_beli (copy)/retur_print.php b/old-source/retur_beli (copy)/retur_print.php new file mode 100644 index 0000000..37f58c0 --- /dev/null +++ b/old-source/retur_beli (copy)/retur_print.php @@ -0,0 +1,163 @@ +query("SELECT nama_supplier, alamat1 + FROM supplier + WHERE kd_supplier = '$_POST[supp]'"); + if ($supplierdata->num_rows > 0) + { + while($s = $supplierdata->fetch_array(MYSQLI_ASSOC)) + { + $namasupp = $s['nama_supplier']; + $alamatsupp = $s['alamat1']; + } + $supplierdata->close(); + } + // ambil item barang yang diretur + $idretur = $_POST['idretur']; + + $returdata = $mysqli->query("SELECT b.kode_barang, b.kode_lama, n.nomor, b.nama_barang, b.kode_supplier, d.jumlah, d.harga_satuan, (d.jumlah * d.harga_satuan) as jum, m.no_nota, n.stok + FROM d_retur_beli d, m_retur_beli m, barang b, no_barang n + WHERE + b.id_gabungan = n.id_gabungan + AND d.id_retur = m.id_retur + AND (d.kd_barang = b.kode_barang AND d.nomor_barang = n.nomor) + AND d.id_retur = $idretur + ORDER BY b.kode_barang"); + + $tabledetil = ""; + if($returdata->num_rows > 0) + { + while($a = $returdata->fetch_array(MYSQLI_ASSOC)) + { + $tabledetil .= " + + + + + "; + $tot=$tot+$a['jum']; + $vol=$vol+$a['jumlah']; + } + $tabledetil .= ""; + /* tutup hasil query */ + $returdata->close(); + } + $tabledetil .= "
BanyakJenis BarangKode AsliHarga SatuanJumlah
".$a['jumlah']."   ".$a['nama_barang']."   ".$a['kode_lama']."".number_format($a['harga_satuan'],0,',','.')."   ".number_format($a['jum'],0,',','.')."  
".$vol."".number_format($tot,0,',','.')."  
"; + echo ""; + echo ""; + + echo "
"; + echo "

"; + echo "
"; + echo "
"; + echo "Kepada Yth, ". $namasupp ."
"; + echo "     ".$alamatsupp."
"; + echo "
"; + echo "Tanggal cetak: ".date('d-m-Y').""; + echo "
"; + echo "


"; + echo "     Dengan hormat,
"; + echo "

     Bersama ini kami kirimkan kembali sebagian barang yang telah kami terima dengan pertimbangan ".$_POST['ketretur'].".
"; + echo "Ada pun barang-barang yang kami kirimkan adalah sebagai berikut :

"; + echo $tabledetil; + echo "

     Demikian, mohon berkenan untuk menerima kembali dengan baik, dan mohon maaf atas pengembalian ini. Terima Kasih.

"; + echo "
"; + + echo "
"; + echo "

"; + echo "
"; + echo "
"; + echo "Kepada Yth, ". $namasupp ."
"; + echo "     ".$alamatsupp."
"; + echo "
"; + echo "Tanggal cetak: ".date('d-m-Y').""; + echo "
"; + echo "


"; + echo "     Dengan hormat,
"; + echo "

     Bersama ini kami kirimkan kembali sebagian barang yang telah kami terima dengan pertimbangan ".$_POST['ketretur'].".
"; + echo "Ada pun barang-barang yang kami kirimkan adalah sebagai berikut :

"; + echo $tabledetil; + echo "

     Demikian, mohon berkenan untuk menerima kembali dengan baik, dan mohon maaf atas pengembalian ini. Terima Kasih.

"; + echo "
"; + + echo "
"; + echo "

"; + echo "
"; + echo "
"; + echo "Kepada Yth, ". $namasupp ."
"; + echo "     ".$alamatsupp."
"; + echo "
"; + echo "Tanggal cetak: ".date('d-m-Y')."
"; + echo "


"; + echo "     Dengan hormat,
"; + echo "

     Bersama ini kami kirimkan kembali sebagian barang yang telah kami terima dengan pertimbangan ".$_POST['ketretur'].".
"; + echo "Ada pun barang-barang yang kami kirimkan adalah sebagai berikut :

"; + echo $tabledetil; + echo "

     Demikian, mohon berkenan untuk menerima kembali dengan baik, dan mohon maaf atas pengembalian ini. Terima Kasih.

"; + echo "
"; + + } +} +?> diff --git a/old-source/retur_beli (copy)/retur_simpan.php b/old-source/retur_beli (copy)/retur_simpan.php new file mode 100644 index 0000000..357805a --- /dev/null +++ b/old-source/retur_beli (copy)/retur_simpan.php @@ -0,0 +1,97 @@ + $kode[$id], 'nomor' => $no_barang[$id], 'kodeasli' => $kodeasli[$id], 'hb' => $hb_satuan[$id], 'jumlah' => $jumlah[$id], 'kodesupp' => $kd_supplier[$id], 'nofaktur' => $no_retur[$id]); + + // urutkan datanya + sort($aDataTransfer); + + // proses penggabungan data yang sama + $aHasil = array(); + $co = 0; + $c=0; + for ($i=0;$iprepare("INSERT INTO m_retur_beli(no_nota, tgl_retur, keterangan, total_retur, nik, jml_item, kd_supplier) + VALUES (?, ?, ?, ?, ?, ?, ?)"); + $stmt->bind_param("sssisis",$nota_retur, $tgl_retur, $ket_retur, $total_retur, $nik, $jumlah_retur, $id_supplier); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = 1; + $retur_id = $mysqli->insert_id; + } + else $hasil = 0; + $stmt->close(); + + // isi table detil retur + for($i=0; $iprepare("INSERT INTO d_retur_beli(id_retur, kd_barang, jumlah, harga_satuan, nomor_barang) + VALUES (?, ?, ?, ?, ?)"); + $stmt->bind_param("isiis",$retur_id, $aHasil[$i]['kode'], $aHasil[$i]['jumlah'], $aHasil[$i]['hb'], $aHasil[$i]['nomor']); + $stmt->execute(); + if($stmt->affected_rows > 0) $hasil = 1; + else $hasil = 0; + $stmt->close(); + } + } + + $harray = array('hasil' => $hasil, 'id_retur' => $retur_id); + echo json_encode($harray); +} diff --git a/old-source/retur_beli (copy)/retur_update.php b/old-source/retur_beli (copy)/retur_update.php new file mode 100644 index 0000000..c50ac3d --- /dev/null +++ b/old-source/retur_beli (copy)/retur_update.php @@ -0,0 +1,124 @@ +prepare("UPDATE m_retur_beli SET no_nota = ?, total_retur = ?, jml_item = ?, kd_supplier = ?, tgl_retur = ?, keterangan = ? WHERE id_retur = ?"); + $stmt->bind_param("siisssi", $no_nota, $total_retur, $jumlah_retur, $kdsupp, $tgl_retur, $ket_retur, $retur_id); + $stmt->execute(); + if($stmt->affected_rows > 0) + $hasilm = 1; + else $hasilm = 0; + $stmt->close(); + // --> end update data table master + + // begin update data table detail <-- + $aDataBaru = array(); + // masukkan semua data baru dalam satu array + for($id=0; $id $kode[$id], 'nomor' => $no_barang[$id], 'hb' => $hb_satuan[$id], 'jumlah' => $jumlah[$id]); + + // urutkan datanya + sort($aDataBaru); + + // proses penggabungan data yang sama + $aBaru = array(); + $co = 0; + $c=0; + for ($i=0;$iquery("SELECT jumlah + FROM d_retur_beli + WHERE id_retur = $retur_id + AND kd_barang = '$k' + AND harga_satuan = $h + AND nomor_barang = '$n'"); + if($dt->num_rows > 0) + { + $a = $dt->fetch_array(MYSQLI_NUM); + // kalau jumlahnya tidak sama, update jumlah + if($aBaru[$x]['jumlah'] != $a[0]) + { + $stmt = $mysqli->prepare("UPDATE d_retur_beli SET jumlah = ? WHERE id_retur = ? AND kd_barang = ? AND harga_satuan = ? AND nomor_barang = ?"); + $stmt->bind_param("iisis", $aBaru[$x]['jumlah'], $retur_id, $aBaru[$x]['kode'], $aBaru[$x]['hb'], $aBaru[$x]['nomor']); + $stmt->execute(); + if($stmt->affected_rows > 0) $hasild = 1; + else $hasild = 0; + $stmt->close(); + } + /* tutup hasil query */ + $dt->close(); + }else + { + // jika data belum ada, insert data baru. + $stmt = $mysqli->prepare("INSERT INTO d_retur_beli(id_retur, kd_barang, jumlah, harga_satuan, nomor_barang) + VALUES (?, ?, ?, ?, ?)"); + $stmt->bind_param("isiis", $retur_id, $aBaru[$x]['kode'], $aBaru[$x]['jumlah'], $aBaru[$x]['hb'], $aBaru[$x]['nomor']); + $stmt->execute(); + if($stmt->affected_rows > 0) $hasild = 1; + else $hasild = 0; + $stmt->close(); + } + } + // --> end update data table detail + } + /* tutup koneksi */ + $mysqli->close(); + $harray = array('hasilm' => $hasilm, 'hasild' => $hasild, 'id_retur' => $retur_id); + echo json_encode($harray); +} + +/* end file */ diff --git a/old-source/retur_beli (copy)/retur_validasi.php b/old-source/retur_beli (copy)/retur_validasi.php new file mode 100644 index 0000000..1654cbd --- /dev/null +++ b/old-source/retur_beli (copy)/retur_validasi.php @@ -0,0 +1,66 @@ +prepare("UPDATE m_retur_beli SET tgl_retur = ?, validasi = '1' WHERE id_retur = ?"); + $stmt->bind_param("si",$tgl_retur, $id_retur); + $stmt->execute(); + if($stmt->affected_rows > 0) + $hasil = 1; + else $hasil = 0; + $stmt->close(); + + // ambil barang yang akan diupdate stok nya. + $barang = array(); + $dataBarang = $mysqli->query("SELECT dr.jumlah, dr.nomor_barang, br.id_gabungan + FROM d_retur_beli dr, m_retur_beli mr, barang br + WHERE dr.id_retur = mr.id_retur + AND mr.id_retur = $id_retur + AND mr.validasi = '1' + AND dr.kd_barang = br.kode_barang"); + $jumBarang = $dataBarang->num_rows; + if($jumBarang > 0) + { + $idx = 0; + while($db = $dataBarang->fetch_array(MYSQLI_ASSOC)) + { + $barang[$idx] = array('id_gabungan' => $db['id_gabungan'], 'jumlah' => $db['jumlah'], 'nomor' => $db['nomor_barang']); + $idx++; + } + /* tutup hasil query */ + $dataBarang->close(); + } + // update stok + for($i=0; $i<$jumBarang; $i++) + { + // update stok barang + $stmt = $mysqli->prepare("UPDATE no_barang SET stok = stok-? WHERE id_gabungan = ? AND nomor = ?"); + $stmt->bind_param("iss",$barang[$i]['jumlah'], $barang[$i]['id_gabungan'], $barang[$i]['nomor']); + $stmt->execute(); + if($stmt->affected_rows > 0) + $hasil = 1; + else + $hasil = 0; + $stmt->close(); + } + + } + $harray = array('hasil' => $hasil); + echo json_encode($harray); +} diff --git a/old-source/retur_beli/ambil_barang.php b/old-source/retur_beli/ambil_barang.php new file mode 100644 index 0000000..2918d10 --- /dev/null +++ b/old-source/retur_beli/ambil_barang.php @@ -0,0 +1,51 @@ +query("SELECT brg.kode_barang,brg.kode_supplier,d.no_faktur,d.kode_asli,brg.nama_barang,n.harga_pokok, n.harga_jual, n.stok, n.nomor + FROM barang brg inner join no_barang n on brg.id_gabungan = n.id_gabungan,d_pembelian d + WHERE n.nomor = '$_REQUEST[nobarang]' + AND (brg.kode_barang = '$_REQUEST[idbarang]' OR brg.kode_lama = '$_REQUEST[idbarang]') + AND (d.kode_barang = brg.kode_barang AND d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + AND n.stok > 0 + ORDER BY brg.kode_barang,n.nomor"); + } else if(!isset($_REQUEST['nobarang'])) + { + $data = $mysqli->query("SELECT brg.kode_barang,brg.kode_supplier,d.no_faktur,d.kode_asli,brg.nama_barang,n.harga_pokok, n.harga_jual, n.stok, n.nomor + FROM barang brg inner join no_barang n on brg.id_gabungan = n.id_gabungan,d_pembelian d + WHERE (brg.kode_barang = '$_REQUEST[idbarang]' OR brg.kode_lama = '$_REQUEST[idbarang]') + AND (brg.kode_barang = d.kode_barang AND d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + AND n.stok > 0 + ORDER BY brg.kode_barang,n.nomor"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'],'kode_supp' => $a['kode_supplier'],'no_faktur' => $a['no_faktur'],'kode_asli' => $a['kode_asli'],'nama_barang' => $a['nama_barang'], + 'harga_beli' => $a['harga_pokok'],'harga_jual' => $a['harga_jual'], 'stok' => $a['stok'], 'nomor_barang' => $a['nomor'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/retur_beli/ambil_barang_kembali.php b/old-source/retur_beli/ambil_barang_kembali.php new file mode 100644 index 0000000..a6a95fb --- /dev/null +++ b/old-source/retur_beli/ambil_barang_kembali.php @@ -0,0 +1,49 @@ +query("SELECT brg.kode_barang,brg.kode_supplier,d.no_faktur,d.kode_asli,brg.nama_barang,n.harga_pokok, n.harga_jual, n.stok, n.nomor + FROM barang brg inner join no_barang n on brg.id_gabungan = n.id_gabungan,d_pembelian d + WHERE n.nomor = '$_REQUEST[nobarang]' + AND brg.kode_barang = '$_REQUEST[idbarang]' + AND (d.kode_barang = brg.kode_barang AND d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + ORDER BY brg.kode_barang,n.nomor"); + } else if(!isset($_REQUEST['nobarang'])) + { + $data = $mysqli->query("SELECT brg.kode_barang,brg.kode_supplier,d.no_faktur,d.kode_asli,brg.nama_barang,n.harga_pokok, n.harga_jual, n.stok, n.nomor + FROM barang brg inner join no_barang n on brg.id_gabungan = n.id_gabungan,d_pembelian d + WHERE brg.kode_barang = '$_REQUEST[idbarang]' + AND (brg.kode_barang = d.kode_barang AND d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + ORDER BY brg.kode_barang,n.nomor"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'],'kode_supp' => $a['kode_supplier'],'no_faktur' => $a['no_faktur'],'kode_asli' => $a['kode_asli'],'nama_barang' => $a['nama_barang'], + 'harga_beli' => $a['harga_pokok'],'harga_jual' => $a['harga_jual'], 'stok' => $a['stok'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/retur_beli/ambil_kode_barang.php b/old-source/retur_beli/ambil_kode_barang.php new file mode 100644 index 0000000..c918f36 --- /dev/null +++ b/old-source/retur_beli/ambil_kode_barang.php @@ -0,0 +1,53 @@ +query("SELECT DISTINCT d.kode_barang, m.kd_supplier, b.nama_barang, sup.nama_supplier, + m.tgl_nota, m.tgl_masuk, m.tgl_jatuh_tempo, m.status, m.keterangan, m.nik + FROM m_pembelian m, d_pembelian d, barang b, supplier sup, no_barang n + WHERE m.no_faktur = d.no_faktur + AND d.kode_barang = b.kode_barang + AND b.id_gabungan = n.id_gabungan + AND m.kd_supplier = sup.kd_supplier + AND n.stok > 0 + AND m.no_faktur='$_REQUEST[nofaktur]' + ORDER BY d.kode_barang"); + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + $jdata = $mysqli->query("SELECT count(*) + FROM m_pembelian m, d_pembelian d, barang b, supplier sup, no_barang n + WHERE m.no_faktur = d.no_faktur + AND d.kode_barang = b.kode_barang + AND b.id_gabungan = n.id_gabungan + AND m.kd_supplier = sup.kd_supplier + AND n.stok > 0 + AND m.no_faktur='$_REQUEST[nofaktur]'"); + $j = $jdata->fetch_array(MYSQL_NUM); + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'], 'kd_supplier' => $a['kd_supplier'], + 'nama_barang' => $a['nama_barang'], 'supplier' => $a['nama_supplier'], + 'tglnota' => $a['tgl_nota'],'tglmasuk' => $a['tgl_masuk'],'tgljthtempo' => $a['tgl_jatuh_tempo'], + 'status' => $a['status'],'keterangan' => $a['keterangan'],'nik' => $a['nik'], + 'jdata' => $j[0] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/retur_beli/ambil_nomor.php b/old-source/retur_beli/ambil_nomor.php new file mode 100644 index 0000000..b5c6157 --- /dev/null +++ b/old-source/retur_beli/ambil_nomor.php @@ -0,0 +1,36 @@ +query("SELECT DISTINCT nomor FROM d_pembelian WHERE kode_barang='$_REQUEST[idbarang]' ORDER BY nomor"); + $data = $mysqli->query("SELECT n.nomor FROM d_pembelian d, no_barang n, barang b + WHERE (b.kode_barang ='$_REQUEST[idbarang]' OR b.kode_lama = '$_REQUEST[idbarang]') + AND b.id_gabungan = n.id_gabungan + AND (d.kode_barang = b.kode_barang and d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + AND n.stok > 0 + ORDER BY nomor"); + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_NUM)) + { + $harray[$idx] = array('nomor' => $a[0]); + $idx++; + } + } + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/retur_beli/cari_nota.php b/old-source/retur_beli/cari_nota.php new file mode 100644 index 0000000..cd4d735 --- /dev/null +++ b/old-source/retur_beli/cari_nota.php @@ -0,0 +1,94 @@ +query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur != "" && $tglawal != "" && $tglakhir != "" && $kdsup == "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur != "" && $tglawal == "" && $tglakhir == "" && $kdsup != "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur != "" && $tglawal == "" && $tglakhir == "" && $kdsup == "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur == "" && $tglawal != "" && $tglakhir != "" && $kdsup != "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur == "" && $tglawal != "" && $tglakhir != "" && $kdsup == "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur == "" && $tglawal == "" && $tglakhir == "" && $kdsup != "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + + $harray[$idx] = array( + 'no_faktur' => $a['no_faktur'], 'tgl_nota' => substr($a['tgl_nota'],8,2)."-".substr($a['tgl_nota'],5,2)."-".substr($a['tgl_nota'],0,4), 'rp_beli' => $a['rp_beli'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/retur_beli/fungsi_retur.php b/old-source/retur_beli/fungsi_retur.php new file mode 100644 index 0000000..9bd5d44 --- /dev/null +++ b/old-source/retur_beli/fungsi_retur.php @@ -0,0 +1,567 @@ + ".$nofaktur; + $stmt = $mysqli->prepare("INSERT INTO m_pembelian VALUES (?, now(), now(), '-', now(), ?, 'T', 0, ?, ?, 0, '1', '$ket', now(), ?, ?)"); + $stmt->bind_param("sssiss", $norhp, $kd_supplier, $nik, $rpbeli, $nofaktur, $statusrvb); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} + +function insert_d_pembelian($norhp, $kode_barang, $kode_lama, $nomor, $stok, $stokrev, $hplama, $hjlama, $hpbaru, $hjbaru, $nama, $idgabungan) +{ + $hasil = FALSE; + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if(!mysqli_connect_errno()) + { + for ($i = 0; $i < count($kode_barang); $i++) + { + /* insert data lama */ + $hplm = decode_hp($hplama[$i]); + $profitlama = ceil((($hjlama[$i] - $hplm) / $hplm) * 100); + $stoklama = -1 * $stok[$i]; + $faktur_asli = get_kode_faktur_asli($kode_barang[$i]); + $stmt = $mysqli->prepare("INSERT INTO d_pembelian(no_faktur, kode_barang, kode_baranglama, nomor, jumlah, harga_satuan, harga_pokok, harga_jual, profit, kode_asli, jum_fisik, jenis, lokasi, hj_final, nm_brg) + VALUES (?, ?, ?, ?, ?, 0, ?, ?, ?, '-', ?, 'S', '1A', ?, ?)"); + $stmt->bind_param("ssssisiiiis", $norhp, $kode_barang[$i], $kode_lama[$i], $nomor[$i], $stoklama, $hplama[$i], $hjlama[$i], $profitlama, $stoklama, $hjlama[$i], $nama[$i]); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + + /* insert data baru */ + if ($hasil) + { + $hpbr = decode_hp($hpbaru[$i]); + $profitbaru = ceil((($hjbaru[$i] - $hpbr) / $hpbr) * 100); + $stmt = $mysqli->prepare("INSERT INTO d_pembelian(no_faktur, kode_barang, kode_baranglama, nomor, jumlah, harga_satuan, harga_pokok, harga_jual, profit, kode_asli, jum_fisik, jenis, lokasi, hj_final, nm_brg) + VALUES (?, ?, ?, ?, ?, 0, ?, ?, ?, '-', ?, 'S', '1A', ?, ?)"); + $stmt->bind_param("ssssisiiiis", $norhp, $kode_barang[$i], $kode_lama[$i], $nomor[$i], $stokrev[$i], $hpbaru[$i], $hjbaru[$i], $profitbaru, $stokrev[$i], $hjbaru[$i], $nama[$i]); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* update barang*/ + if ($hasil) + { + $update2 = update_barang($idgabungan[$i], $nama[$i]); + if($update2) + { + $hasil = TRUE; + } else + { + $hasil = FALSE; + } + } + + /* update no_barang*/ + if ($hasil) + { + $update = update_no_barang($idgabungan[$i], $nomor[$i], $hpbaru[$i], $hjbaru[$i], $stokrev[$i]); + if($update) + { + $hasil = TRUE; + } else + { + $hasil = FALSE; + } + } + $faktur_asli = ""; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} + +/** + * + * @param $id + * @param $nomor + * @param $hp + * @param $hj + * @return unknown_type + */ +function update_no_barang($id, $nomor, $hp, $hj, $stokrev) +{ + $hasil = FALSE; + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if(!mysqli_connect_errno()) + { + // isi table master + $stmt = $mysqli->prepare("UPDATE no_barang SET stok = ?,harga_pokok = ?, harga_jual = ? WHERE id_gabungan = ? AND nomor = ?"); + $stmt->bind_param("isiss", $stokrev, $hp, $hj, $id, $nomor); + $stmt->execute(); + if($stmt->affected_rows >= 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} + +function update_barang($id, $nama) +{ + $hasil = FALSE; + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if(!mysqli_connect_errno()) + { + // isi table master + $stmt = $mysqli->prepare("UPDATE barang SET nama_barang = ? WHERE id_gabungan = ?"); + $stmt->bind_param("ss", $nama, $id); + $stmt->execute(); + if($stmt->affected_rows >= 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} +/** + * + * @param $kdsupplier + * @return unknown_type + */ +function get_no_rhp($kdsupplier) +{ + $urutbaru = 0; + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + // cek ada atau tidak + if(cek_data($kdsupplier)) + { + $data_faktur = $mysqli->query("SELECT MAX(RIGHT(no_faktur, 3)) FROM m_pembelian WHERE LEFT(no_faktur, 10) = 'RVB-{$kdsupplier}'"); + if($data_faktur->num_rows > 0) + { + $urut = $data_faktur->fetch_array(); + $urutbaru = (int)$urut[0] + 1; + if(strlen($urutbaru) == 1) + { + $urutbaru = "00".$urutbaru; + } + if(strlen($urutbaru) == 2) + { + $urutbaru = "0".$urutbaru; + } + /* tutup hasil query */ + $data_faktur->close(); + } + } else + { + $urutbaru = "000"; + } + $hasil[0] = "RVB-".$kdsupplier."-".$urutbaru; + echo json_encode($hasil); + /* tutup koneksi */ + $mysqli->close(); +} + +/** + * + * @param $kodesupplier + * @return unknown_type + */ +function cek_data($kodesupplier) +{ + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + // cek ada atau tidak + $data = $mysqli->query("SELECT COUNT(*) FROM m_pembelian WHERE LEFT(no_faktur, 10) = 'RVB-{$kodesupplier}'"); + $dt = $data->fetch_array(); + if($dt[0] > 0) + { + return true; + } else + { + return false; + } + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); +} + +/** + * + * @param $kode + * @param $nomor + * @param $kd_supplier + * @return unknown_type + */ +function ambil_barang($kode, $nomor, $nofaktur) +{ + if($kode != "" || $nomor != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if($nomor != "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.kode_lama, brg.nama_barang, brg.id_gabungan, nb.stok, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, supplier s, d_pembelian dp + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND brg.kode_barang = '{$kode}' AND nb.nomor = '{$nomor}' + AND brg.kode_supplier = s.kd_supplier AND dp.no_faktur = '{$nofaktur}' LIMIT 1"); + } else if($nomor == "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.kode_lama, brg.nama_barang, brg.id_gabungan, nb.stok, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, supplier s, d_pembelian dp + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND brg.kode_barang = '{$kode}' + AND brg.kode_supplier = s.kd_supplier AND dp.no_faktur = '{$nofaktur}' LIMIT 1"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('kode_barang' => $a['kode_barang'], 'kode_lama' => $a['kode_lama'], 'nama_barang' => $a['nama_barang'], + 'supplier' => $a['nama_supplier'], 'id_gabungan' => $a['id_gabungan'], 'stok' => $a['stok'], + 'kd_supplier' => $a['kode_supplier'], 'hp' => $a['harga_pokok'], 'hj' => $a['harga_jual'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kode + * @param $nomor + * @param $kd_supplier + * @return unknown_type + */ +function cek_barang($kode, $nomor, $nofaktur) +{ + if($kode != "" || $nomor != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + + if($nomor != "") + { + $data = $mysqli->query("SELECT count(*) + FROM barang brg, no_barang nb, d_pembelian dp + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND brg.kode_barang = '{$kode}' AND nb.nomor = '{$nomor}' + AND dp.no_faktur = '{$nofaktur}'"); + } else if($nomor == "") + { + $data = $mysqli->query("SELECT count(*) + FROM barang brg + WHERE brg.kode_barang = '{$kode}'"); + } + if($data->num_rows > 0) + { + $jum = $data->fetch_array(); + if($jum[0] > 0) + { + $harray[0] = "true"; + } else + { + $harray[0] = "false"; + } + /* tutup hasil query */ + $data->close(); + } else + { + $harray[0] = "false"; + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kode + * @param $nama + * @param $kd_supplier + * @return unknown_type + */ +function cari_barang($kode, $nama) +{ + if($kode != "" || $nama != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + + if($nama != "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.nama_barang, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, d_pembelian dp, supplier s + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND brg.kode_supplier = s.kd_supplier + AND brg.nama_barang LIKE '%{$nama}%'"); + } else if($nama == "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.nama_barang, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, d_pembelian dp, supplier s + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang AND brg.kode_supplier = s.kd_supplier + AND (brg.kode_barang LIKE '{$kode}%' OR brg.kode_lama LIKE '{$kode}')"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'], 'nama_barang' => $a['nama_barang'], 'supplier' => $a['nama_supplier'], + 'kd_supplier' => $a['kode_supplier'], 'hp' => $a['harga_pokok'], 'hj' => $a['harga_jual'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kode + * @param $nama + * @return unknown_type + */ +function get_supplier($kode, $nama) +{ + if($kode != "" || $nama != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + + if($nama != "") + { + $data = $mysqli->query("SELECT s.kd_supplier, s.nama_supplier + FROM supplier s + WHERE s.kd_supplier LIKE '%{$kode}%' AND s.nama_supplier LIKE '%{$nama}%'"); + } else if($nama == "") + { + $data = $mysqli->query("SELECT s.kd_supplier, s.nama_supplier + FROM supplier s + WHERE s.kd_supplier LIKE '%{$kode}%'"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('kode_supplier' => $a['kd_supplier'], 'nama_supplier' => $a['nama_supplier']); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kodebarang + * @return unknown_type + */ +function get_kode_faktur_asli($kodebarang) +{ + $faktur = ""; + if($kodebarang != "" ) + { + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + + $data = $mysqli->query("SELECT d.no_faktur FROM d_pembelian d WHERE d.kode_barang = '{$kodebarang}'"); + if($data->num_rows > 0) + { + $faktur = $data->fetch_array(MYSQLI_NUM); + $faktur = $faktur[0]; + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + return $faktur; +} +/** + * + * @param $data + * @return unknown_type + */ +function hitung_total_hp($data, $stok) +{ + $total = 0; + for ($i = 0; $i < count($data); $i++) + { + $total += decode_hp($data[$i]) * $stok[$i]; + } + return $total; +} + +/** + * + * @param $hp + * @return int hasil decode + */ +function decode_hp($hp) +{ + $dt = ""; + for($i = 0; $i < strlen($hp); $i++) + { + $chr = substr($hp, $i, 1); + switch($chr) + { + case "B" : $dt .= "1";break; + case "R" : $dt .= "2";break; + case "A" : $dt .= "3";break; + case "W" : $dt .= "4";break; + case "N" : $dt .= "5";break; + case "F" : $dt .= "6";break; + case "O" : $dt .= "7";break; + case "X" : $dt .= "8";break; + case "E" : $dt .= "9";break; + case "S" : $dt .= "0";break; + } + } + return (int) $dt; +} +?> diff --git a/old-source/retur_beli/hmenu.php~ b/old-source/retur_beli/hmenu.php~ new file mode 100644 index 0000000..ed1d5c8 --- /dev/null +++ b/old-source/retur_beli/hmenu.php~ @@ -0,0 +1,128 @@ + diff --git a/old-source/retur_beli/menu.php b/old-source/retur_beli/menu.php new file mode 100644 index 0000000..47cf73f --- /dev/null +++ b/old-source/retur_beli/menu.php @@ -0,0 +1,130 @@ + + + + + +
+ +
diff --git a/old-source/retur_beli/retur_ambil_alasan.php b/old-source/retur_beli/retur_ambil_alasan.php new file mode 100644 index 0000000..1a6ef74 --- /dev/null +++ b/old-source/retur_beli/retur_ambil_alasan.php @@ -0,0 +1,28 @@ +query("SELECT DISTINCT(keterangan) FROM m_retur_beli"); +if($data->num_rows > 0) +{ + $idx = 0; + while($ket = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('keterangan' => $ket['keterangan']); + $idx += 1; + } + /* tutup hasil query */ + $data->close(); +} +/* tutup koneksi */ +$mysqli->close(); +/* cetak hasil */ +echo json_encode($harray); diff --git a/old-source/retur_beli/retur_ambil_barang.php b/old-source/retur_beli/retur_ambil_barang.php new file mode 100644 index 0000000..54fc25b --- /dev/null +++ b/old-source/retur_beli/retur_ambil_barang.php @@ -0,0 +1,45 @@ +query("SELECT b.kode_barang, b.kode_lama, n.nomor, b.nama_barang, b.kode_supplier, d.jumlah, d.harga_satuan, (d.jumlah * d.harga_satuan) as jum, m.no_nota, n.stok + FROM d_retur_beli d, m_retur_beli m, barang b, no_barang n + WHERE + b.id_gabungan = n.id_gabungan + AND d.id_retur = m.id_retur + AND (d.kd_barang = b.kode_barang AND d.nomor_barang = n.nomor) + AND d.id_retur = $idretur + ORDER BY b.kode_barang"); + /* tampung jumlah data dalam var hasil */ + if($data->num_rows > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('kd_barang' => $a['kode_barang'], 'kode_asli' => $a['kode_lama'], 'jumlah' => $a['jumlah'], 'nama_barang' => $a['nama_barang'], 'kode_supp' => $a['kode_supplier'], 'harga_satuan' => $a['harga_satuan'], 'nomor_barang' => $a['nomor'], 'no_nota' => $a['no_nota'], 'stokakh' => $a['stok']); + $idx++; + } + + /* tutup hasil query */ + $data->close(); + + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/retur_beli/retur_ambil_keterangan.php b/old-source/retur_beli/retur_ambil_keterangan.php new file mode 100644 index 0000000..69159fe --- /dev/null +++ b/old-source/retur_beli/retur_ambil_keterangan.php @@ -0,0 +1,33 @@ +query("SELECT mp.tgl_nota, mp.kd_supplier + FROM m_pembelian mp + WHERE no_faktur = '$_REQUEST[nonota]'"); + $data2 = $mysqli->query("SELECT SUM( jumlah ) FROM d_retur_beli WHERE id_retur = $_REQUEST[idretur] GROUP BY id_retur"); + if($data1->num_rows > 0 && $data2->num_rows > 0) + { + $ket = $data1->fetch_array(MYSQLI_ASSOC); + $jum = $data2->fetch_array(MYSQLI_NUM); + $harray = array('tgl_nota' => substr($ket['tgl_nota'],8,2)."-".substr($ket['tgl_nota'],5,2)."-".substr($ket['tgl_nota'],0,4), 'kd_supplier' => $ket['kd_supplier'], 'jumlah' => $jum[0]); + /* tutup hasil query */ + $data1->close(); + $data2->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); +} \ No newline at end of file diff --git a/old-source/retur_beli/retur_beli_fbaru.php b/old-source/retur_beli/retur_beli_fbaru.php new file mode 100644 index 0000000..5e4efff --- /dev/null +++ b/old-source/retur_beli/retur_beli_fbaru.php @@ -0,0 +1,233 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ Retur Pembelian - Baru + + + + + + + + + + + + + + + + +
Tanggal Retur: + + Kode Supplier:
No.Faktur Retur: NIK:
Total Retur: Keterangan: +   
Jumlah Item Retur:
+
+ + + + + + + + + + +
KODE BARANGBARCODENAMA BARANGHARGA SATUAN BELISTOK KOMPJML RETUR
+
+
+ + + +
+
+
+
+ +
+ + +
+

+
+ +
+

+
+ +
+ + + + + + + + + + + +
Nomor Faktur:
Rentang Tanggal: + s/d + +
Kode Supplier:
+
+ Hasil pencarian +
+
+
+ + +
+ + + + + + + + +
Kode Barang:
Nama Barang: + +
+
+ Hasil pencarian +
+
+
+ + + + + + + + + + diff --git a/old-source/retur_beli/retur_beli_fedit.php b/old-source/retur_beli/retur_beli_fedit.php new file mode 100644 index 0000000..0e230f2 --- /dev/null +++ b/old-source/retur_beli/retur_beli_fedit.php @@ -0,0 +1,241 @@ + + + + + :: Pengadaan Barang + + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ Retur Pembelian - Edit + + + + + + + + + + + + + + + + + + + + + +
ID Retur: + + Kode Supplier:
Tanggal Retur: + NIK:
No.Faktur Retur: Keterangan: +   
Total Retur:
Jumlah Item Retur:
+
+ + + + + + + + + + + +
+
+ + + + + +
+
+
+
+ +
+ + +
+

+
+ +
+

+
+ +
+ + + + + + + + +
ID Retur:
Rentang Tanggal: + s/d + +
+
+ Hasil pencarian +
+
+
+ + + + + + + + diff --git a/old-source/retur_beli/retur_beli_fprint.php b/old-source/retur_beli/retur_beli_fprint.php new file mode 100644 index 0000000..dcef9f4 --- /dev/null +++ b/old-source/retur_beli/retur_beli_fprint.php @@ -0,0 +1,214 @@ + + + + + :: Pengadaan Barang + + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ Retur Pembelian - Print + + + + + + + + + + + + + + + + + + + + + +
ID Retur: + + Kode Supplier:
Tanggal Retur: + NIK:
No.Faktur Retur: Keterangan:
Total Retur:
Jumlah Item Retur:
+
+ + + + + + + + + + +
+
+ +
+
+
+
+ +
+ + +
+

+
+ +
+

+
+ +
+ + + + + + + + +
ID Retur:
Rentang Tanggal: + s/d + +
+
+ Hasil pencarian +
+
+
+ + + + + + + diff --git a/old-source/retur_beli/retur_cari_nota.php b/old-source/retur_beli/retur_cari_nota.php new file mode 100644 index 0000000..bdb9085 --- /dev/null +++ b/old-source/retur_beli/retur_cari_nota.php @@ -0,0 +1,60 @@ +query("SELECT mr.id_retur, mr.no_nota, mr.tgl_retur, mr.keterangan, mr.total_retur, mr.nik, mr.kd_supplier, mr.jml_item + FROM m_retur_beli mr + WHERE mr.id_retur = '$nofaktur' + AND mr.tgl_retur BETWEEN '$tglawal' AND '$tglakhir' + AND mr.validasi = '$valid'"); + else if($nofaktur != "" && $tglawal == "" && $tglakhir == "") + $data = $mysqli->query("SELECT mr.id_retur, mr.no_nota, mr.tgl_retur, mr.keterangan, mr.total_retur, mr.nik, mr.kd_supplier, mr.jml_item + FROM m_retur_beli mr + WHERE mr.id_retur = '$nofaktur' + AND mr.validasi = '$valid'"); + else if($nofaktur == "" && $tglawal != "" && $tglakhir != "") + $data = $mysqli->query("SELECT mr.id_retur, mr.no_nota, mr.tgl_retur, mr.keterangan, mr.total_retur, mr.nik, mr.kd_supplier, mr.jml_item + FROM m_retur_beli mr + WHERE mr.tgl_retur BETWEEN '$tglawal' AND '$tglakhir' + AND mr.validasi = '$valid'"); + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'id_retur' => $a['id_retur'], 'no_nota' => $a['no_nota'], 'tgl_retur' => substr($a['tgl_retur'],8,2)."-".substr($a['tgl_retur'],5,2)."-".substr($a['tgl_retur'],0,4), + 'keterangan' => $a['keterangan'], 'total_retur' => $a['total_retur'], 'nik' => $a['nik'], 'kdsupp' => $a['kd_supplier'], 'jml_item' => $a['jml_item'], + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + + echo json_encode($harray); +} diff --git a/old-source/retur_beli/retur_hapus.php b/old-source/retur_beli/retur_hapus.php new file mode 100644 index 0000000..ef60bad --- /dev/null +++ b/old-source/retur_beli/retur_hapus.php @@ -0,0 +1,30 @@ +prepare("DELETE FROM d_retur_beli WHERE id_retur = ? AND kd_barang = ? AND jumlah = ? AND harga_satuan = ? LIMIT 1"); + $stmt->bind_param("isii",$retur_id, $kode, $jumlah, $harga); + $stmt->execute(); + if($stmt->affected_rows > 0) $hasil = 1; + else $hasil = 0; + $stmt->close(); + } + $harray = array('hasil' => $hasil); + echo json_encode($harray); +} +/* end file */ diff --git a/old-source/retur_beli/retur_print.php b/old-source/retur_beli/retur_print.php new file mode 100644 index 0000000..37f58c0 --- /dev/null +++ b/old-source/retur_beli/retur_print.php @@ -0,0 +1,163 @@ +query("SELECT nama_supplier, alamat1 + FROM supplier + WHERE kd_supplier = '$_POST[supp]'"); + if ($supplierdata->num_rows > 0) + { + while($s = $supplierdata->fetch_array(MYSQLI_ASSOC)) + { + $namasupp = $s['nama_supplier']; + $alamatsupp = $s['alamat1']; + } + $supplierdata->close(); + } + // ambil item barang yang diretur + $idretur = $_POST['idretur']; + + $returdata = $mysqli->query("SELECT b.kode_barang, b.kode_lama, n.nomor, b.nama_barang, b.kode_supplier, d.jumlah, d.harga_satuan, (d.jumlah * d.harga_satuan) as jum, m.no_nota, n.stok + FROM d_retur_beli d, m_retur_beli m, barang b, no_barang n + WHERE + b.id_gabungan = n.id_gabungan + AND d.id_retur = m.id_retur + AND (d.kd_barang = b.kode_barang AND d.nomor_barang = n.nomor) + AND d.id_retur = $idretur + ORDER BY b.kode_barang"); + + $tabledetil = ""; + if($returdata->num_rows > 0) + { + while($a = $returdata->fetch_array(MYSQLI_ASSOC)) + { + $tabledetil .= " + + + + + "; + $tot=$tot+$a['jum']; + $vol=$vol+$a['jumlah']; + } + $tabledetil .= ""; + /* tutup hasil query */ + $returdata->close(); + } + $tabledetil .= "
BanyakJenis BarangKode AsliHarga SatuanJumlah
".$a['jumlah']."   ".$a['nama_barang']."   ".$a['kode_lama']."".number_format($a['harga_satuan'],0,',','.')."   ".number_format($a['jum'],0,',','.')."  
".$vol."".number_format($tot,0,',','.')."  
"; + echo ""; + echo ""; + + echo "
"; + echo "

"; + echo "
"; + echo "
"; + echo "Kepada Yth, ". $namasupp ."
"; + echo "     ".$alamatsupp."
"; + echo "
"; + echo "Tanggal cetak: ".date('d-m-Y').""; + echo "
"; + echo "


"; + echo "     Dengan hormat,
"; + echo "

     Bersama ini kami kirimkan kembali sebagian barang yang telah kami terima dengan pertimbangan ".$_POST['ketretur'].".
"; + echo "Ada pun barang-barang yang kami kirimkan adalah sebagai berikut :

"; + echo $tabledetil; + echo "

     Demikian, mohon berkenan untuk menerima kembali dengan baik, dan mohon maaf atas pengembalian ini. Terima Kasih.

"; + echo "
"; + + echo "
"; + echo "

"; + echo "
"; + echo "
"; + echo "Kepada Yth, ". $namasupp ."
"; + echo "     ".$alamatsupp."
"; + echo "
"; + echo "Tanggal cetak: ".date('d-m-Y').""; + echo "
"; + echo "


"; + echo "     Dengan hormat,
"; + echo "

     Bersama ini kami kirimkan kembali sebagian barang yang telah kami terima dengan pertimbangan ".$_POST['ketretur'].".
"; + echo "Ada pun barang-barang yang kami kirimkan adalah sebagai berikut :

"; + echo $tabledetil; + echo "

     Demikian, mohon berkenan untuk menerima kembali dengan baik, dan mohon maaf atas pengembalian ini. Terima Kasih.

"; + echo "
"; + + echo "
"; + echo "

"; + echo "
"; + echo "
"; + echo "Kepada Yth, ". $namasupp ."
"; + echo "     ".$alamatsupp."
"; + echo "
"; + echo "Tanggal cetak: ".date('d-m-Y')."
"; + echo "


"; + echo "     Dengan hormat,
"; + echo "

     Bersama ini kami kirimkan kembali sebagian barang yang telah kami terima dengan pertimbangan ".$_POST['ketretur'].".
"; + echo "Ada pun barang-barang yang kami kirimkan adalah sebagai berikut :

"; + echo $tabledetil; + echo "

     Demikian, mohon berkenan untuk menerima kembali dengan baik, dan mohon maaf atas pengembalian ini. Terima Kasih.

"; + echo "
"; + + } +} +?> diff --git a/old-source/retur_beli/retur_simpan.php b/old-source/retur_beli/retur_simpan.php new file mode 100644 index 0000000..357805a --- /dev/null +++ b/old-source/retur_beli/retur_simpan.php @@ -0,0 +1,97 @@ + $kode[$id], 'nomor' => $no_barang[$id], 'kodeasli' => $kodeasli[$id], 'hb' => $hb_satuan[$id], 'jumlah' => $jumlah[$id], 'kodesupp' => $kd_supplier[$id], 'nofaktur' => $no_retur[$id]); + + // urutkan datanya + sort($aDataTransfer); + + // proses penggabungan data yang sama + $aHasil = array(); + $co = 0; + $c=0; + for ($i=0;$iprepare("INSERT INTO m_retur_beli(no_nota, tgl_retur, keterangan, total_retur, nik, jml_item, kd_supplier) + VALUES (?, ?, ?, ?, ?, ?, ?)"); + $stmt->bind_param("sssisis",$nota_retur, $tgl_retur, $ket_retur, $total_retur, $nik, $jumlah_retur, $id_supplier); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = 1; + $retur_id = $mysqli->insert_id; + } + else $hasil = 0; + $stmt->close(); + + // isi table detil retur + for($i=0; $iprepare("INSERT INTO d_retur_beli(id_retur, kd_barang, jumlah, harga_satuan, nomor_barang) + VALUES (?, ?, ?, ?, ?)"); + $stmt->bind_param("isiis",$retur_id, $aHasil[$i]['kode'], $aHasil[$i]['jumlah'], $aHasil[$i]['hb'], $aHasil[$i]['nomor']); + $stmt->execute(); + if($stmt->affected_rows > 0) $hasil = 1; + else $hasil = 0; + $stmt->close(); + } + } + + $harray = array('hasil' => $hasil, 'id_retur' => $retur_id); + echo json_encode($harray); +} diff --git a/old-source/retur_beli/retur_update.php b/old-source/retur_beli/retur_update.php new file mode 100644 index 0000000..c50ac3d --- /dev/null +++ b/old-source/retur_beli/retur_update.php @@ -0,0 +1,124 @@ +prepare("UPDATE m_retur_beli SET no_nota = ?, total_retur = ?, jml_item = ?, kd_supplier = ?, tgl_retur = ?, keterangan = ? WHERE id_retur = ?"); + $stmt->bind_param("siisssi", $no_nota, $total_retur, $jumlah_retur, $kdsupp, $tgl_retur, $ket_retur, $retur_id); + $stmt->execute(); + if($stmt->affected_rows > 0) + $hasilm = 1; + else $hasilm = 0; + $stmt->close(); + // --> end update data table master + + // begin update data table detail <-- + $aDataBaru = array(); + // masukkan semua data baru dalam satu array + for($id=0; $id $kode[$id], 'nomor' => $no_barang[$id], 'hb' => $hb_satuan[$id], 'jumlah' => $jumlah[$id]); + + // urutkan datanya + sort($aDataBaru); + + // proses penggabungan data yang sama + $aBaru = array(); + $co = 0; + $c=0; + for ($i=0;$iquery("SELECT jumlah + FROM d_retur_beli + WHERE id_retur = $retur_id + AND kd_barang = '$k' + AND harga_satuan = $h + AND nomor_barang = '$n'"); + if($dt->num_rows > 0) + { + $a = $dt->fetch_array(MYSQLI_NUM); + // kalau jumlahnya tidak sama, update jumlah + if($aBaru[$x]['jumlah'] != $a[0]) + { + $stmt = $mysqli->prepare("UPDATE d_retur_beli SET jumlah = ? WHERE id_retur = ? AND kd_barang = ? AND harga_satuan = ? AND nomor_barang = ?"); + $stmt->bind_param("iisis", $aBaru[$x]['jumlah'], $retur_id, $aBaru[$x]['kode'], $aBaru[$x]['hb'], $aBaru[$x]['nomor']); + $stmt->execute(); + if($stmt->affected_rows > 0) $hasild = 1; + else $hasild = 0; + $stmt->close(); + } + /* tutup hasil query */ + $dt->close(); + }else + { + // jika data belum ada, insert data baru. + $stmt = $mysqli->prepare("INSERT INTO d_retur_beli(id_retur, kd_barang, jumlah, harga_satuan, nomor_barang) + VALUES (?, ?, ?, ?, ?)"); + $stmt->bind_param("isiis", $retur_id, $aBaru[$x]['kode'], $aBaru[$x]['jumlah'], $aBaru[$x]['hb'], $aBaru[$x]['nomor']); + $stmt->execute(); + if($stmt->affected_rows > 0) $hasild = 1; + else $hasild = 0; + $stmt->close(); + } + } + // --> end update data table detail + } + /* tutup koneksi */ + $mysqli->close(); + $harray = array('hasilm' => $hasilm, 'hasild' => $hasild, 'id_retur' => $retur_id); + echo json_encode($harray); +} + +/* end file */ diff --git a/old-source/retur_beli/retur_validasi.php b/old-source/retur_beli/retur_validasi.php new file mode 100644 index 0000000..1654cbd --- /dev/null +++ b/old-source/retur_beli/retur_validasi.php @@ -0,0 +1,66 @@ +prepare("UPDATE m_retur_beli SET tgl_retur = ?, validasi = '1' WHERE id_retur = ?"); + $stmt->bind_param("si",$tgl_retur, $id_retur); + $stmt->execute(); + if($stmt->affected_rows > 0) + $hasil = 1; + else $hasil = 0; + $stmt->close(); + + // ambil barang yang akan diupdate stok nya. + $barang = array(); + $dataBarang = $mysqli->query("SELECT dr.jumlah, dr.nomor_barang, br.id_gabungan + FROM d_retur_beli dr, m_retur_beli mr, barang br + WHERE dr.id_retur = mr.id_retur + AND mr.id_retur = $id_retur + AND mr.validasi = '1' + AND dr.kd_barang = br.kode_barang"); + $jumBarang = $dataBarang->num_rows; + if($jumBarang > 0) + { + $idx = 0; + while($db = $dataBarang->fetch_array(MYSQLI_ASSOC)) + { + $barang[$idx] = array('id_gabungan' => $db['id_gabungan'], 'jumlah' => $db['jumlah'], 'nomor' => $db['nomor_barang']); + $idx++; + } + /* tutup hasil query */ + $dataBarang->close(); + } + // update stok + for($i=0; $i<$jumBarang; $i++) + { + // update stok barang + $stmt = $mysqli->prepare("UPDATE no_barang SET stok = stok-? WHERE id_gabungan = ? AND nomor = ?"); + $stmt->bind_param("iss",$barang[$i]['jumlah'], $barang[$i]['id_gabungan'], $barang[$i]['nomor']); + $stmt->execute(); + if($stmt->affected_rows > 0) + $hasil = 1; + else + $hasil = 0; + $stmt->close(); + } + + } + $harray = array('hasil' => $hasil); + echo json_encode($harray); +} diff --git a/old-source/rincian_jual.php b/old-source/rincian_jual.php new file mode 100644 index 0000000..0737383 --- /dev/null +++ b/old-source/rincian_jual.php @@ -0,0 +1,351 @@ + + + + Cleopatra + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+"; + echo "div#divprint{width:900px; border:0px solid #000; padding:20px 0; margin-bottom:25px;}"; + echo "table.tbl {width:875px;border-width:0 0 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl,table.tbl td {border-color:#000;border-style:solid;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "table.tbl1 {width:900px;border-width:0 0 0 0;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:left;}"; + echo "table.tbl1,table.tbl1 td {border-color:#000;border-style:solid;}"; + echo "table.tbl1 td {margin:0;padding:2px;border-width:0 0 0 0;}"; + echo "body {font-size:10pt;}"; + echo "div.luar{text-align:left;margin-left:20px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ".warnaBarisStrip{font-weight : bold; background-color : #FFFF33;}"; + echo ".warnaBarisKategori{font-weight : bold; background-color: #FFCC00;}"; + echo ".master{text-align:left;}"; + echo ""; + + $nonota = $_GET['nota']; + if(substr($_GET['nota'],0,2) == 'B-'): + $nonotabon = $nonota; + bon($nonotabon); + elseif(substr($_GET['nota'],0,2) == 'W-'): + $nonotabawa = $nonota; + bawa($nonotabawa); + elseif(substr($_GET['nota'],0,2) == 'R-'): + $nonotaretur = $nonota; + retur($nonotaretur); + else: + $nonotatunai = $nonota; + tunai($nonotatunai); + endif; + +function bon($nonotabon) +{ + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Rekap Bon*/ + $query = "SELECT d.`kd_brg`, d.`nomor`, b.nama_barang,d.`jumlah`, d.`diskon`, + d.`hrg_satuan`,(d.`hrg_satuan`*d.`jumlah`) subtotal,d.`kd_pram` + FROM d_bon d,barang b + where d.`kd_brg`=b.kode_barang + and d.no_bon = '$nonotabon'"; + $query2 = "select m.no_bon,m.tgl_bon,m.kode_plg, + m.jumlah_total,m.diskon, + m.bank,m.no_kartu,m.kasir + from m_bon m + where m.no_bon = '$nonotabon'"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdbrg,$nomor,$nmbrg,$jum,$diskon,$hj,$subtotal,$kdpram); + + print("
"); + print("

Rincian Penjualan


"); + print("

"); + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$nota,$tglnota,$kdcust,$tot,$disc,$bank,$kartu,$kasir); + while(mysqli_stmt_fetch($stmt2)){ + print("Nomor Nota : ".$nota."
"); + print("Tanggal Nota : ".$tglnota."
"); + print("Plg : ".$kdcust."
"); + print("Total : ".number_format($tot,0,',','.')."
"); + print("Jumlah uang : ".number_format($totuang,0,',','.')."
"); + print("Discount : ".$disc."
"); + print("Bank : ".$bank."
"); + print("No.kartu : ".$kartu."
"); + print("Kasir : ".$kasir."

"); + } + } + } + + + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + print(""); + } + + print("
Kode Brg.NomorNamaJumlDiscHJSub TotalKd Pram
$kdbrg$nomor$nmbrg$jum".$diskon."".number_format($hj,0,',','.')."".number_format($subtotal,0,',','.')."$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + //print("

"); + } +} + +function bawa($nonotabawa) +{ + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Rekap Bawa*/ + $query = "SELECT d.`kd_barang`, d.`no_barang`, b.nama_barang,d.`jumlah`, + d.`harga_satuan`,(d.`harga_satuan`*d.`jumlah`) subtotal,d.`kode_pram` + FROM d_nota_bawa d,barang b + where d.`kd_barang`=b.kode_barang + and d.no_nota = '$nonotabawa'"; + $query2 = "select m.no_nota,m.tgl_nota,m.kd_customer, + m.jumlah_total,m.kasir + from m_nota_bawa m + where m.no_nota = '$nonotabawa'"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdbrg,$nomor,$nmbrg,$jum,$hj,$subtotal,$kdpram); + + print("
"); + print("

Rincian Penjualan


"); + print("

"); + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$nota,$tglnota,$kdcust,$tot,$kasir); + while(mysqli_stmt_fetch($stmt2)){ + print("Nomor Nota : ".$nota."
"); + print("Tanggal Nota : ".$tglnota."
"); + print("Plg : ".$kdcust."
"); + print("Total : ".number_format($tot,0,',','.')."
"); + print("Kasir : ".$kasir."

"); + } + } + } + + + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + print(""); + } + + print("
Kode Brg.NomorNamaJumlHJSub TotalKd Pram
$kdbrg$nomor$nmbrg$jum".number_format($hj,0,',','.')."".number_format($subtotal,0,',','.')."$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + //print("

"); + } +} + +function retur($nonotaretur) +{ + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Rekap Tunai*/ + $query = "SELECT d.`kd_barang`, d.`no_barang`, b.nama_barang,d.`jumlah`, d.`diskon`, + d.`harga_jual`,(d.`harga_jual`*d.`jumlah`) subtotal,d.no_nota_tunai,d.`kode_pram` + FROM d_nota_retur d,barang b + where d.`kd_barang`=b.kode_barang + and d.no_nota = '$nonotaretur'"; + $query2 = "select m.no_nota,m.tgl_nota,m.kd_customer, + m.jumlah_total,m.total_diskon,m.keterangan,m.kasir + from m_nota_retur m + where m.no_nota = '$nonotaretur'"; + + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$kdbrg,$nomor,$nmbrg,$jum,$diskon,$hj,$subtotal,$notatunai,$kdpram); + + print("
"); + print("

Rincian Penjualan


"); + print("

"); + + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek2 = mysqli_stmt_num_rows($stmt2); + if($cek2 > 0){ + mysqli_stmt_bind_result($stmt2,$nota,$tglnota,$kdcust,$tot,$disc,$keterangan,$kasir); + while(mysqli_stmt_fetch($stmt2)){ + print("Nomor Nota : ".$nota."
"); + print("Tanggal Nota : ".$tglnota."
"); + print("Plg : ".$kdcust."
"); + print("Total : ".number_format($tot,0,',','.')."
"); + print("Keterangan : ".$keterangan."
"); + print("Kasir : ".$kasir."

"); + } + } + } + + + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + print(""); + } + + print("
Kode Brg.NomorNamaJumlDiscHJSub TotalNota tunaiKd Pram
$kdbrg$nomor$nmbrg$jum".$diskon."".number_format($hj,0,',','.')."".number_format($subtotal,0,',','.')."$notatunai$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + //print("

"); + } +} + +function tunai($nonotatunai) +{ + + include "./db_login.inc.php"; + + $toko = substr($nonotatunai,1,1); + $database = '$dbh'.$toko; + + $dbh = mysql_connect(HOST,USER,PASSWORD); + $dbh1 = mysql_connect($hostname, $username, $password); + $dbh2 = mysql_connect($hostname, $username, $password, true); + $dbh3 = mysql_connect($hostname, $username, $password, true); + $dbh4 = mysql_connect($hostname, $username, $password, true); + $dbh5 = mysql_connect($hostname, $username, $password, true); + $dbh6 = mysql_connect($hostname, $username, $password, true); + $dbh7 = mysql_connect($hostname, $username, $password, true); + $dbh8 = mysql_connect($hostname, $username, $password, true); + $dbh9 = mysql_connect($hostname, $username, $password, true); + + mysql_select_db(DATABASE,$dbh); + mysql_select_db('amigo01', $dbh1); + mysql_select_db('amigo02', $dbh2); + mysql_select_db('amigo03', $dbh3); + mysql_select_db('amigo04', $dbh4); + mysql_select_db('amigo05', $dbh5); + mysql_select_db('amigo06', $dbh6); + mysql_select_db('amigo07', $dbh7); + mysql_select_db('amigo08', $dbh8); + mysql_select_db('amigo09', $dbh9); + + if($database == '$dbh1'){ + $data = $dbh1; + }elseif($database == '$dbh2'){ + $data = $dbh2; + }elseif($database == '$dbh3'){ + $data = $dbh3; + }elseif($database == '$dbh4'){ + $data = $dbh4; + }elseif($database == '$dbh5'){ + $data = $dbh5; + }elseif($database == '$dbh6'){ + $data = $dbh6; + }elseif($database == '$dbh7'){ + $data = $dbh7; + }elseif($database == '$dbh8'){ + $data = $dbh8; + }elseif($database == '$dbh9'){ + $data = $dbh9; + } + /*----------------------------------------Rekap Tunai*/ + $query = mysql_query("SELECT d.`kd_barang`, d.`no_barang`, b.nama_barang,d.`jumlah`, d.`diskon`, + d.`harga_jual`,(d.`harga_jual`*d.`jumlah`) subtotal,d.`kode_pram` + FROM d_nota_tunai d,barang b + where d.`kd_barang`=b.kode_barang + and d.no_nota = '$nonotatunai'",$data); + $query2 = mysql_query("select m.no_nota,m.tgl_nota,m.kd_customer, + m.jumlah_total,m.total_uang,m.total_diskon, + m.bank,m.no_kartu,m.kasir + from m_nota_tunai m + where m.no_nota = '$nonotatunai'",$data); + + + print("
"); + print("

Rincian Penjualan


"); + print("

"); + + while($rowM=mysql_fetch_array($query2)){ + print("Nomor Nota : ".$rowM['no_nota']."
"); + print("Tanggal Nota : ".$rowM['tgl_nota']."
"); + print("Plg : ".$rowM['tgl_nota']."
"); + print("Total : ".number_format($rowM['jumlah_total'],0,',','.')."
"); + print("Jumlah uang : ".number_format($rowM['total_uang'],0,',','.')."
"); + print("Discount : ".$rowM['total_diskon']."
"); + print("Bank : ".$rowM['bank']."
"); + print("No.kartu : ".$rowM['no_kartu']."
"); + print("Kasir : ".$rowM['kasir']."

"); + } + + print(""); + print(""); + + while($rowD=mysql_fetch_array($query)){ + print(" + + "); + } + + print("
Kode Brg.NomorNamaJumlDiscHJSub TotalKd Pram
$rowD[kd_barang]$rowD[no_barang]$rowD[nama_barang]$rowD[jumlah]$rowD[diskon]".number_format($rowD['harga_jual'],0,',','.')."".number_format($rowD['subtotal'],0,',','.')."$rowD[kode_pram]

"); + print("
"); +} + +?> + +
+ + + + + diff --git a/old-source/rincitrans.php b/old-source/rincitrans.php new file mode 100644 index 0000000..1ddd963 --- /dev/null +++ b/old-source/rincitrans.php @@ -0,0 +1,160 @@ +"; + echo "table.tbl {width:950px;border-width:1px 1px 1px 1px;border-spacing:0;border-collapse:collapse;font-size:9pt;text-align:center;}"; + echo "table.tbl td {margin:0;padding:2px;border-width:1px 1px 0 0;}"; + echo "body {font-size:9pt;}"; + echo "div.luar{text-align:left;margin-left:150px;}"; + echo ".header{font-weight:bold;text-align:center;}"; + echo ".isi{text-align:left;}"; + echo ""; + +// $kodebarang = $_GET['n']; +// if(strlen($_GET['n']) > 12): +// $kodebarang = substr($_GET['n'],0,12); +// $nomor = substr($_GET['n'],12); +// elseif(strlen($_GET['n']) > 9): +// $kodebarang = substr($_GET['n'],0,9); +// $nomor = substr($_GET['n'],9); +// endif; + $startDate = decTgl($_POST['startDate2']); + $endDate = decTgl($_POST['endDate2']); + + if(bukaKoneksi()){ + global $conn; + /*----------------------------------------Rekap Tunai*/ + $query = "SELECT m.tgl_nota,d.no_nota,d.kd_barang,b.nama_barang,s.nama_supplier,d.no_barang,d.jumlah,d.diskon,d.harga_jual,d.kode_pram + FROM d_nota_tunai d,barang b,m_nota_tunai m, supplier s + WHERE d.kd_barang = b.kode_barang + and b.kode_supplier = s.kd_supplier + and d.no_nota = m.no_nota + and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' + order by m.tgl_nota"; + if($stmt = mysqli_prepare($conn,$query)){ + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + $cek = mysqli_stmt_num_rows($stmt); + if($cek > 0){ + mysqli_stmt_bind_result($stmt,$tgl,$nota,$kdbrg,$nmbrg,$kdlama,$no,$jml,$disc,$hj,$kdpram); + + print("
"); + print("

Rekap Transaksi Tunai



"); + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt)){ + print(""); + } + + print("
Tanggal NotaNo.NotaKode Brg.Nama Brg.SupplierNomorJumlDiscHJKd Pram
$tgl$nota$kdbrg$nmbrg$kdlama$no$jml$disc".number_format($hj,0,',','.')."$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + /*----------------------------------------Rekap bon barang*/ + $query2 = "SELECT m.tgl_bon,d.no_bon,m.kode_plg,d.kd_brg,b.nama_barang,s.nama_supplier,d.nomor,d.jumlah,d.diskon,d.hrg_satuan,d.kd_pram + FROM d_bon d, barang b, m_bon m, supplier s + WHERE d.kd_brg = b.kode_barang + and b.kode_supplier = s.kd_supplier + and d.no_bon = m.no_bon + and date(m.tgl_bon) BETWEEN '$startDate' AND '$endDate' + order by m.tgl_bon"; + if($stmt2 = mysqli_prepare($conn,$query2)){ + mysqli_stmt_execute($stmt2); + mysqli_stmt_store_result($stmt2); + $cek = mysqli_stmt_num_rows($stmt2); + if($cek > 0){ + mysqli_stmt_bind_result($stmt2,$tgl,$nota,$kdplg,$kdbrg,$nmbrg,$kdlama,$no,$jml,$disc,$hj,$kdpram); + + print("
"); + print("

Rekap Transaksi Bon



"); + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt2)){ + print(""); + } + + print("
Tanggal NotaNo.NotaKd.PlgKode Brg.Nama Brg.SupplierNomorJumlDiscHJKd Pram
$tgl$nota$kdplg$kdbrg$nmbrg$kdlama$no$jml$disc".number_format($hj,0,',','.')."$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + /*----------------------------------------Rekap Bawa */ + $query3 = "SELECT m.tgl_nota,d.no_nota,m.kd_customer,d.kd_barang,b.nama_barang,d.status_barang,s.nama_supplier,d.no_barang,d.jumlah,d.harga_satuan,d.kode_pram + FROM d_nota_bawa d,barang b,m_nota_bawa m, supplier s + WHERE d.kd_barang = b.kode_barang + and d.no_nota = m.no_nota + and b.kode_supplier = s.kd_supplier + and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' + order by m.tgl_nota"; + //and status_barang is null + if($stmt3 = mysqli_prepare($conn,$query3)){ + mysqli_stmt_execute($stmt3); + mysqli_stmt_store_result($stmt3); + $cek = mysqli_stmt_num_rows($stmt3); + if($cek > 0){ + mysqli_stmt_bind_result($stmt3,$tgl,$nota,$kd_customer,$kdbrg,$nmbrg,$status,$kdlama,$no,$jml,$hj,$kdpram); + + print("
"); + print("

Rekap Transaksi Bawa



"); + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt3)){ + print(""); + } + + print("
Tanggal NotaNo.NotaKd. PlgKode Brg.Nama Brg.StatusSupplierNomorJumlHJKd Pram
$tgl$nota$kd_customer$kdbrg$nmbrg$status$kdlama$no$jml".number_format($hj,0,',','.')."$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + /*----------------------------------------Rekap retur */ + $query4 = "SELECT m.tgl_nota,d.no_nota,d.kd_barang,b.nama_barang,s.nama_supplier,d.no_barang,d.jumlah,d.diskon,d.harga_jual,d.kode_pram + FROM d_nota_retur d,barang b,m_nota_retur m, supplier s + WHERE d.kd_barang = b.kode_barang + and d.no_nota = m.no_nota + and b.kode_supplier = s.kd_supplier + and date(m.tgl_nota) BETWEEN '$startDate' AND '$endDate' + order by m.tgl_nota"; + if($stmt4 = mysqli_prepare($conn,$query4)){ + mysqli_stmt_execute($stmt4); + mysqli_stmt_store_result($stmt4); + $cek = mysqli_stmt_num_rows($stmt4); + if($cek > 0){ + mysqli_stmt_bind_result($stmt4,$tgl,$nota,$kdbrg,$nmbrg,$kdlama,$no,$jml,$disc,$hj,$kdpram); + + print("
"); + print("

Rekap Transaksi Retur



"); + print("

"); + print(""); + print(""); + + while(mysqli_stmt_fetch($stmt4)){ + print(""); + } + + print("
Tanggal NotaNo.NotaKode Brg.Nama Brg.Kode LamaNomorJumlDiscHJKd Pram
$tgl$nota$kdbrg$nmbrg$kdlama$no$jml$disc".number_format($hj,0,',','.')."$kdpram

"); + print("
"); + }else{ + echo "data tdk ada!"; + echo "
"; + } + } + + print("
"); + } +?> diff --git a/old-source/satuanbrg.php b/old-source/satuanbrg.php new file mode 100644 index 0000000..c63094e --- /dev/null +++ b/old-source/satuanbrg.php @@ -0,0 +1,92 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Satuan Barang +
+ + + + + + + + + + + +
ID Satuan Barang: + + + + +
Nama Satuan Barang: + +

+ +
+
+
+ +
+ +
+
Cari Satuan Barang
+
+ +
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + diff --git a/old-source/strip.php b/old-source/strip.php new file mode 100644 index 0000000..1bd5a9a --- /dev/null +++ b/old-source/strip.php @@ -0,0 +1,180 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Group Product +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Group Product: + + + + +
Nama Group Product: + +

Batas Bawah Murah: + +
Batas Atas Murah: + +

Batas Bawah Sedang: + +
Batas Atas Sedang: + +

Batas Bawah Mahal: + +
Batas Atas Mahal: + +

Bonus Benik Murah: + +
Bonus Benik Sedang: + +
Bonus Benik Mahal: + +
Kelompok Barang: + +
Kategori: + (P,W,A,S) +
Persen Thiwul: + +

+ +
+
+
+ +
+ +
+
Cari Group Product
+
+ +
+
+ + + + +
Kode Lini Produk:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + diff --git a/old-source/supp_barang.php b/old-source/supp_barang.php new file mode 100644 index 0000000..d362492 --- /dev/null +++ b/old-source/supp_barang.php @@ -0,0 +1,60 @@ + + + + + Cleopatra + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Tambah Supp Barang +
+ + + + + + + + + + + + + + + + +
Kode Supplier:
Lini Produk:
Ranking:

+ +
+
+
+ +
+ + diff --git a/old-source/supplier.php b/old-source/supplier.php new file mode 100644 index 0000000..61032d2 --- /dev/null +++ b/old-source/supplier.php @@ -0,0 +1,183 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Supplier +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Kode Supplier: + + + + +
Supplier: + * +
Alamat: + * +
Nama rekening: + +
Nomor Rekening: + +
Bank: + +
Alamat 2: + +
Nomor Rekening 2: + +
Bank 2: + +
Telp: + +
Ponsel: + +
Email: + +
Fax: + +
Jenis pembayaran: + [H]utang,[T]unai,[K]onsinyasi +
Lama tempo: + +

+ +
+
+
+ +
+ +
+
Cari Supplier
+
+ +
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + diff --git a/old-source/tmplapbyrpersup.php b/old-source/tmplapbyrpersup.php new file mode 100644 index 0000000..fa45711 --- /dev/null +++ b/old-source/tmplapbyrpersup.php @@ -0,0 +1,82 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+ Laporan Pembayaran Per Supplier +
+
+
+ + +
Range Tanggal: s/d
+
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/old-source/transfer_barang/ambil_barang.php b/old-source/transfer_barang/ambil_barang.php new file mode 100644 index 0000000..e8ad9e5 --- /dev/null +++ b/old-source/transfer_barang/ambil_barang.php @@ -0,0 +1,51 @@ +query("SELECT brg.kode_barang,brg.kode_supplier,d.no_faktur,d.kode_asli,brg.nama_barang,n.harga_pokok, n.harga_jual, n.stok, n.nomor + FROM barang brg inner join no_barang n on brg.id_gabungan = n.id_gabungan,d_pembelian d + WHERE n.nomor = '$_REQUEST[nobarang]' + AND brg.kode_barang = '$_REQUEST[idbarang]' + AND (d.kode_barang = brg.kode_barang AND d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + AND n.stok > 0 + ORDER BY brg.kode_barang,n.nomor"); + } else if(!isset($_REQUEST['nobarang'])) + { + $data = $mysqli->query("SELECT brg.kode_barang,brg.kode_supplier,d.no_faktur,d.kode_asli,brg.nama_barang,n.harga_pokok, n.harga_jual, n.stok, n.nomor + FROM barang brg inner join no_barang n on brg.id_gabungan = n.id_gabungan,d_pembelian d + WHERE brg.kode_barang = '$_REQUEST[idbarang]' + AND (brg.kode_barang = d.kode_barang AND d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + AND n.stok > 0 + ORDER BY brg.kode_barang,n.nomor"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'],'kode_supp' => $a['kode_supplier'],'no_faktur' => $a['no_faktur'],'kode_asli' => $a['kode_asli'],'nama_barang' => $a['nama_barang'], + 'harga_beli' => $a['harga_pokok'],'harga_jual' => $a['harga_jual'], 'stok' => $a['stok'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/transfer_barang/ambil_barang_kembali.php b/old-source/transfer_barang/ambil_barang_kembali.php new file mode 100644 index 0000000..a6a95fb --- /dev/null +++ b/old-source/transfer_barang/ambil_barang_kembali.php @@ -0,0 +1,49 @@ +query("SELECT brg.kode_barang,brg.kode_supplier,d.no_faktur,d.kode_asli,brg.nama_barang,n.harga_pokok, n.harga_jual, n.stok, n.nomor + FROM barang brg inner join no_barang n on brg.id_gabungan = n.id_gabungan,d_pembelian d + WHERE n.nomor = '$_REQUEST[nobarang]' + AND brg.kode_barang = '$_REQUEST[idbarang]' + AND (d.kode_barang = brg.kode_barang AND d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + ORDER BY brg.kode_barang,n.nomor"); + } else if(!isset($_REQUEST['nobarang'])) + { + $data = $mysqli->query("SELECT brg.kode_barang,brg.kode_supplier,d.no_faktur,d.kode_asli,brg.nama_barang,n.harga_pokok, n.harga_jual, n.stok, n.nomor + FROM barang brg inner join no_barang n on brg.id_gabungan = n.id_gabungan,d_pembelian d + WHERE brg.kode_barang = '$_REQUEST[idbarang]' + AND (brg.kode_barang = d.kode_barang AND d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + ORDER BY brg.kode_barang,n.nomor"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'],'kode_supp' => $a['kode_supplier'],'no_faktur' => $a['no_faktur'],'kode_asli' => $a['kode_asli'],'nama_barang' => $a['nama_barang'], + 'harga_beli' => $a['harga_pokok'],'harga_jual' => $a['harga_jual'], 'stok' => $a['stok'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/transfer_barang/ambil_kode_barang.php b/old-source/transfer_barang/ambil_kode_barang.php new file mode 100644 index 0000000..c918f36 --- /dev/null +++ b/old-source/transfer_barang/ambil_kode_barang.php @@ -0,0 +1,53 @@ +query("SELECT DISTINCT d.kode_barang, m.kd_supplier, b.nama_barang, sup.nama_supplier, + m.tgl_nota, m.tgl_masuk, m.tgl_jatuh_tempo, m.status, m.keterangan, m.nik + FROM m_pembelian m, d_pembelian d, barang b, supplier sup, no_barang n + WHERE m.no_faktur = d.no_faktur + AND d.kode_barang = b.kode_barang + AND b.id_gabungan = n.id_gabungan + AND m.kd_supplier = sup.kd_supplier + AND n.stok > 0 + AND m.no_faktur='$_REQUEST[nofaktur]' + ORDER BY d.kode_barang"); + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + $jdata = $mysqli->query("SELECT count(*) + FROM m_pembelian m, d_pembelian d, barang b, supplier sup, no_barang n + WHERE m.no_faktur = d.no_faktur + AND d.kode_barang = b.kode_barang + AND b.id_gabungan = n.id_gabungan + AND m.kd_supplier = sup.kd_supplier + AND n.stok > 0 + AND m.no_faktur='$_REQUEST[nofaktur]'"); + $j = $jdata->fetch_array(MYSQL_NUM); + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'], 'kd_supplier' => $a['kd_supplier'], + 'nama_barang' => $a['nama_barang'], 'supplier' => $a['nama_supplier'], + 'tglnota' => $a['tgl_nota'],'tglmasuk' => $a['tgl_masuk'],'tgljthtempo' => $a['tgl_jatuh_tempo'], + 'status' => $a['status'],'keterangan' => $a['keterangan'],'nik' => $a['nik'], + 'jdata' => $j[0] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/transfer_barang/ambil_nomor.php b/old-source/transfer_barang/ambil_nomor.php new file mode 100644 index 0000000..cde9905 --- /dev/null +++ b/old-source/transfer_barang/ambil_nomor.php @@ -0,0 +1,36 @@ +query("SELECT DISTINCT nomor FROM d_pembelian WHERE kode_barang='$_REQUEST[idbarang]' ORDER BY nomor"); + $data = $mysqli->query("SELECT n.nomor FROM d_pembelian d, no_barang n, barang b + WHERE d.kode_barang='$_REQUEST[idbarang]' + AND b.id_gabungan = n.id_gabungan + AND (d.kode_barang = b.kode_barang and d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + AND n.stok > 0 + ORDER BY nomor"); + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_NUM)) + { + $harray[$idx] = array('nomor' => $a[0]); + $idx++; + } + } + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} \ No newline at end of file diff --git a/old-source/transfer_barang/ambil_nomor_kembali.php b/old-source/transfer_barang/ambil_nomor_kembali.php new file mode 100644 index 0000000..4bbf87f --- /dev/null +++ b/old-source/transfer_barang/ambil_nomor_kembali.php @@ -0,0 +1,35 @@ +query("SELECT DISTINCT nomor FROM d_pembelian WHERE kode_barang='$_REQUEST[idbarang]' ORDER BY nomor"); + $data = $mysqli->query("SELECT n.nomor FROM d_pembelian d, no_barang n, barang b + WHERE d.kode_barang='$_REQUEST[idbarang]' + AND b.id_gabungan = n.id_gabungan + AND (d.kode_barang = b.kode_barang and d.nomor = n.nomor) + AND left(d.no_faktur,4) <> 'RVB-' + ORDER BY nomor"); + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_NUM)) + { + $harray[$idx] = array('nomor' => $a[0]); + $idx++; + } + } + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} \ No newline at end of file diff --git a/old-source/transfer_barang/cari_nota.php b/old-source/transfer_barang/cari_nota.php new file mode 100644 index 0000000..cd4d735 --- /dev/null +++ b/old-source/transfer_barang/cari_nota.php @@ -0,0 +1,94 @@ +query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur != "" && $tglawal != "" && $tglakhir != "" && $kdsup == "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur != "" && $tglawal == "" && $tglakhir == "" && $kdsup != "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur != "" && $tglawal == "" && $tglakhir == "" && $kdsup == "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur == "" && $tglawal != "" && $tglakhir != "" && $kdsup != "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur == "" && $tglawal != "" && $tglakhir != "" && $kdsup == "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur == "" && $tglawal == "" && $tglakhir == "" && $kdsup != "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + + $harray[$idx] = array( + 'no_faktur' => $a['no_faktur'], 'tgl_nota' => substr($a['tgl_nota'],8,2)."-".substr($a['tgl_nota'],5,2)."-".substr($a['tgl_nota'],0,4), 'rp_beli' => $a['rp_beli'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/transfer_barang/fungsi_transfer.php b/old-source/transfer_barang/fungsi_transfer.php new file mode 100644 index 0000000..c4a46c9 --- /dev/null +++ b/old-source/transfer_barang/fungsi_transfer.php @@ -0,0 +1,567 @@ + ".$nofaktur; + $stmt = $mysqli->prepare("INSERT INTO m_pembelian VALUES (?, now(), now(), '-', now(), ?, 'T', 0, ?, ?, 0, '1', '$ket', now(), ?, ?)"); + $stmt->bind_param("sssiss", $norhp, $kd_supplier, $nik, $rpbeli, $nofaktur, $statusrvb); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} + +function insert_d_pembelian($norhp, $kode_barang, $kode_lama, $nomor, $stok, $stokrev, $hplama, $hjlama, $hpbaru, $hjbaru, $nama, $idgabungan) +{ + $hasil = FALSE; + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if(!mysqli_connect_errno()) + { + for ($i = 0; $i < count($kode_barang); $i++) + { + /* insert data lama */ + $hplm = decode_hp($hplama[$i]); + $profitlama = ceil((($hjlama[$i] - $hplm) / $hplm) * 100); + $stoklama = -1 * $stok[$i]; + $faktur_asli = get_kode_faktur_asli($kode_barang[$i]); + $stmt = $mysqli->prepare("INSERT INTO d_pembelian(no_faktur, kode_barang, kode_baranglama, nomor, jumlah, harga_satuan, harga_pokok, harga_jual, profit, kode_asli, jum_fisik, jenis, lokasi, hj_final, nm_brg) + VALUES (?, ?, ?, ?, ?, 0, ?, ?, ?, '-', ?, 'S', '1A', ?, ?)"); + $stmt->bind_param("ssssisiiiis", $norhp, $kode_barang[$i], $kode_lama[$i], $nomor[$i], $stoklama, $hplama[$i], $hjlama[$i], $profitlama, $stoklama, $hjlama[$i], $nama[$i]); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + + /* insert data baru */ + if ($hasil) + { + $hpbr = decode_hp($hpbaru[$i]); + $profitbaru = ceil((($hjbaru[$i] - $hpbr) / $hpbr) * 100); + $stmt = $mysqli->prepare("INSERT INTO d_pembelian(no_faktur, kode_barang, kode_baranglama, nomor, jumlah, harga_satuan, harga_pokok, harga_jual, profit, kode_asli, jum_fisik, jenis, lokasi, hj_final, nm_brg) + VALUES (?, ?, ?, ?, ?, 0, ?, ?, ?, '-', ?, 'S', '1A', ?, ?)"); + $stmt->bind_param("ssssisiiiis", $norhp, $kode_barang[$i], $kode_lama[$i], $nomor[$i], $stokrev[$i], $hpbaru[$i], $hjbaru[$i], $profitbaru, $stokrev[$i], $hjbaru[$i], $nama[$i]); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* update barang*/ + if ($hasil) + { + $update2 = update_barang($idgabungan[$i], $nama[$i]); + if($update2) + { + $hasil = TRUE; + } else + { + $hasil = FALSE; + } + } + + /* update no_barang*/ + if ($hasil) + { + $update = update_no_barang($idgabungan[$i], $nomor[$i], $hpbaru[$i], $hjbaru[$i], $stokrev[$i]); + if($update) + { + $hasil = TRUE; + } else + { + $hasil = FALSE; + } + } + $faktur_asli = ""; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} + +/** + * + * @param $id + * @param $nomor + * @param $hp + * @param $hj + * @return unknown_type + */ +function update_no_barang($id, $nomor, $hp, $hj, $stokrev) +{ + $hasil = FALSE; + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if(!mysqli_connect_errno()) + { + // isi table master + $stmt = $mysqli->prepare("UPDATE no_barang SET stok = ?,harga_pokok = ?, harga_jual = ? WHERE id_gabungan = ? AND nomor = ?"); + $stmt->bind_param("isiss", $stokrev, $hp, $hj, $id, $nomor); + $stmt->execute(); + if($stmt->affected_rows >= 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} + +function update_barang($id, $nama) +{ + $hasil = FALSE; + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if(!mysqli_connect_errno()) + { + // isi table master + $stmt = $mysqli->prepare("UPDATE barang SET nama_barang = ? WHERE id_gabungan = ?"); + $stmt->bind_param("ss", $nama, $id); + $stmt->execute(); + if($stmt->affected_rows >= 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} +/** + * + * @param $kdsupplier + * @return unknown_type + */ +function get_no_rhp($kdsupplier) +{ + $urutbaru = 0; + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + // cek ada atau tidak + if(cek_data($kdsupplier)) + { + $data_faktur = $mysqli->query("SELECT MAX(RIGHT(no_faktur, 3)) FROM m_pembelian WHERE LEFT(no_faktur, 10) = 'RVB-{$kdsupplier}'"); + if($data_faktur->num_rows > 0) + { + $urut = $data_faktur->fetch_array(); + $urutbaru = (int)$urut[0] + 1; + if(strlen($urutbaru) == 1) + { + $urutbaru = "00".$urutbaru; + } + if(strlen($urutbaru) == 2) + { + $urutbaru = "0".$urutbaru; + } + /* tutup hasil query */ + $data_faktur->close(); + } + } else + { + $urutbaru = "000"; + } + $hasil[0] = "RVB-".$kdsupplier."-".$urutbaru; + echo json_encode($hasil); + /* tutup koneksi */ + $mysqli->close(); +} + +/** + * + * @param $kodesupplier + * @return unknown_type + */ +function cek_data($kodesupplier) +{ + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + // cek ada atau tidak + $data = $mysqli->query("SELECT COUNT(*) FROM m_pembelian WHERE LEFT(no_faktur, 10) = 'RVB-{$kodesupplier}'"); + $dt = $data->fetch_array(); + if($dt[0] > 0) + { + return true; + } else + { + return false; + } + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); +} + +/** + * + * @param $kode + * @param $nomor + * @param $kd_supplier + * @return unknown_type + */ +function ambil_barang($kode, $nomor, $nofaktur) +{ + if($kode != "" || $nomor != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if($nomor != "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.kode_lama, brg.nama_barang, brg.id_gabungan, nb.stok, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, supplier s, d_pembelian dp + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND brg.kode_barang = '{$kode}' AND nb.nomor = '{$nomor}' + AND brg.kode_supplier = s.kd_supplier AND dp.no_faktur = '{$nofaktur}' LIMIT 1"); + } else if($nomor == "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.kode_lama, brg.nama_barang, brg.id_gabungan, nb.stok, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, supplier s, d_pembelian dp + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND brg.kode_barang = '{$kode}' + AND brg.kode_supplier = s.kd_supplier AND dp.no_faktur = '{$nofaktur}' LIMIT 1"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('kode_barang' => $a['kode_barang'], 'kode_lama' => $a['kode_lama'], 'nama_barang' => $a['nama_barang'], + 'supplier' => $a['nama_supplier'], 'id_gabungan' => $a['id_gabungan'], 'stok' => $a['stok'], + 'kd_supplier' => $a['kode_supplier'], 'hp' => $a['harga_pokok'], 'hj' => $a['harga_jual'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kode + * @param $nomor + * @param $kd_supplier + * @return unknown_type + */ +function cek_barang($kode, $nomor, $nofaktur) +{ + if($kode != "" || $nomor != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + + if($nomor != "") + { + $data = $mysqli->query("SELECT count(*) + FROM barang brg, no_barang nb, d_pembelian dp + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND brg.kode_barang = '{$kode}' AND nb.nomor = '{$nomor}' + AND dp.no_faktur = '{$nofaktur}'"); + } else if($nomor == "") + { + $data = $mysqli->query("SELECT count(*) + FROM barang brg + WHERE brg.kode_barang = '{$kode}'"); + } + if($data->num_rows > 0) + { + $jum = $data->fetch_array(); + if($jum[0] > 0) + { + $harray[0] = "true"; + } else + { + $harray[0] = "false"; + } + /* tutup hasil query */ + $data->close(); + } else + { + $harray[0] = "false"; + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kode + * @param $nama + * @param $kd_supplier + * @return unknown_type + */ +function cari_barang($kode, $nama) +{ + if($kode != "" || $nama != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + + if($nama != "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.nama_barang, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, d_pembelian dp, supplier s + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND brg.kode_supplier = s.kd_supplier + AND brg.nama_barang LIKE '%{$nama}%'"); + } else if($nama == "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.nama_barang, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, d_pembelian dp, supplier s + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang AND brg.kode_supplier = s.kd_supplier + AND brg.kode_barang LIKE '{$kode}%'"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'], 'nama_barang' => $a['nama_barang'], 'supplier' => $a['nama_supplier'], + 'kd_supplier' => $a['kode_supplier'], 'hp' => $a['harga_pokok'], 'hj' => $a['harga_jual'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kode + * @param $nama + * @return unknown_type + */ +function get_supplier($kode, $nama) +{ + if($kode != "" || $nama != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + + if($nama != "") + { + $data = $mysqli->query("SELECT s.kd_supplier, s.nama_supplier + FROM supplier s + WHERE s.kd_supplier LIKE '%{$kode}%' AND s.nama_supplier LIKE '%{$nama}%'"); + } else if($nama == "") + { + $data = $mysqli->query("SELECT s.kd_supplier, s.nama_supplier + FROM supplier s + WHERE s.kd_supplier LIKE '%{$kode}%'"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('kode_supplier' => $a['kd_supplier'], 'nama_supplier' => $a['nama_supplier']); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kodebarang + * @return unknown_type + */ +function get_kode_faktur_asli($kodebarang) +{ + $faktur = ""; + if($kodebarang != "" ) + { + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + + $data = $mysqli->query("SELECT d.no_faktur FROM d_pembelian d WHERE d.kode_barang = '{$kodebarang}'"); + if($data->num_rows > 0) + { + $faktur = $data->fetch_array(MYSQLI_NUM); + $faktur = $faktur[0]; + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + return $faktur; +} +/** + * + * @param $data + * @return unknown_type + */ +function hitung_total_hp($data, $stok) +{ + $total = 0; + for ($i = 0; $i < count($data); $i++) + { + $total += decode_hp($data[$i]) * $stok[$i]; + } + return $total; +} + +/** + * + * @param $hp + * @return int hasil decode + */ +function decode_hp($hp) +{ + $dt = ""; + for($i = 0; $i < strlen($hp); $i++) + { + $chr = substr($hp, $i, 1); + switch($chr) + { + case "B" : $dt .= "1";break; + case "R" : $dt .= "2";break; + case "A" : $dt .= "3";break; + case "W" : $dt .= "4";break; + case "N" : $dt .= "5";break; + case "F" : $dt .= "6";break; + case "O" : $dt .= "7";break; + case "X" : $dt .= "8";break; + case "E" : $dt .= "9";break; + case "S" : $dt .= "0";break; + } + } + return (int) $dt; +} +?> \ No newline at end of file diff --git a/old-source/transfer_barang/hmenu.php~ b/old-source/transfer_barang/hmenu.php~ new file mode 100644 index 0000000..d85bac3 --- /dev/null +++ b/old-source/transfer_barang/hmenu.php~ @@ -0,0 +1,128 @@ + diff --git a/old-source/transfer_barang/menu.php b/old-source/transfer_barang/menu.php new file mode 100644 index 0000000..ee6ae61 --- /dev/null +++ b/old-source/transfer_barang/menu.php @@ -0,0 +1,130 @@ + + + + + +
+ +
diff --git a/old-source/transfer_barang/transfer_ambil_barang.php b/old-source/transfer_barang/transfer_ambil_barang.php new file mode 100644 index 0000000..ec0ec20 --- /dev/null +++ b/old-source/transfer_barang/transfer_ambil_barang.php @@ -0,0 +1,45 @@ +query("SELECT dt.kode_barang_nota, d.kode_asli,b.nama_barang, dt.jumlah, dt.harga_satuan, dt.nomor, dt.kd_supplier, dt.no_nota, n.stok + FROM d_transfer dt, barang b,d_pembelian d, no_barang n + WHERE (dt.kode_barang_nota = b.kode_barang AND dt.nomor = d.nomor) + AND (d.kode_barang = b.kode_barang AND d.nomor = n.nomor) + AND b.id_gabungan = n.id_gabungan + AND left(d.no_faktur,4) <> 'RVB-' + AND dt.id_transfer = $_REQUEST[idtransfer] + ORDER BY dt.kode_barang_nota,dt.nomor"); + if($data->num_rows > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kd_barang' => $a['kode_barang_nota'], 'nama_barang' => $a['nama_barang'], 'kode_asli' => $a['kode_asli'], + 'jumlah' => $a['jumlah'], 'harga_satuan' => $a['harga_satuan'], 'nomor_barang' => $a['nomor'], 'kd_supp' => $a['kd_supplier'], 'no_nota' => $a['no_nota'], 'stok' => $a['stok']); + $idx++; + } + + /* tutup hasil query */ + $data->close(); + + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} \ No newline at end of file diff --git a/old-source/transfer_barang/transfer_cari_nota.php b/old-source/transfer_barang/transfer_cari_nota.php new file mode 100644 index 0000000..085ac7c --- /dev/null +++ b/old-source/transfer_barang/transfer_cari_nota.php @@ -0,0 +1,61 @@ +query("SELECT mt.id_transfer, mt.tgl_transfer, mt.toko_asal, mt.toko_tujuan, mt.diskon, mt.jml_item, mt.total_transfer + FROM m_transfer mt + WHERE mt.id_transfer LIKE '%$nofaktur%' + AND mt.tgl_transfer BETWEEN '$tglawal' AND '$tglakhir' + AND mt.validasi = '$valid'"); + else if($nofaktur != "" && $tglawal == "" && $tglakhir == "") + $data = $mysqli->query("SELECT mt.id_transfer, mt.tgl_transfer, mt.toko_asal, mt.toko_tujuan, mt.diskon, mt.jml_item, mt.total_transfer + FROM m_transfer mt + WHERE mt.id_transfer LIKE '%$nofaktur%' + AND mt.validasi = '$valid'"); + else if($nofaktur == "" && $tglawal != "" && $tglakhir != "") + $data = $mysqli->query("SELECT mt.id_transfer, mt.tgl_transfer, mt.toko_asal, mt.toko_tujuan, mt.diskon, mt.jml_item, mt.total_transfer + FROM m_transfer mt + WHERE mt.tgl_transfer BETWEEN '$tglawal' AND '$tglakhir' + AND mt.validasi = '$valid'"); + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'id_transfer' => $a['id_transfer'], 'tgl_transfer' => substr($a['tgl_transfer'],8,2)."-".substr($a['tgl_transfer'],5,2)."-".substr($a['tgl_transfer'],0,4), + 'toko_asal' => $a['toko_asal'], 'toko_tujuan' => $a['toko_tujuan'], 'diskon' => $a['diskon'], 'jml_item' => $a['jml_item'], 'total_transfer' => $a['total_transfer'], + 'faktur_oper' => $_SESSION["kodetoko"]."-".substr($a['tgl_transfer'],5,2)."-".substr($a['tgl_transfer'],0,4)."-".$a['id_transfer'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + + echo json_encode($harray); +} \ No newline at end of file diff --git a/old-source/transfer_barang/transfer_fbaru.php b/old-source/transfer_barang/transfer_fbaru.php new file mode 100644 index 0000000..a0867e5 --- /dev/null +++ b/old-source/transfer_barang/transfer_fbaru.php @@ -0,0 +1,215 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ Transfer Barang - Baru + + + + + + + + + + + + + + + +
Tanggal Transfer: + + Toko Asal:
Diskon: %Toko Tujuan:
Total Oper:
Jumlah Item Oper:
+
+ + + + + + + + + + + +
KODE BARANGKODE ASLINAMA BARANGNOMORHARGA SATUAN BELISTOK KOMPJML TRANSFER
+
+
+ + + +
+
+
+
+ +
+ + +
+

+
+ +
+

+
+ +
+ + + + + + + + + + + +
Nomor Faktur:
Rentang Tanggal: + s/d + +
Kode Supplier:
+
+ Hasil pencarian +
+
+
+ + +
+ + + + + + + + +
Kode Barang:
Nama Barang: + +
+
+ Hasil pencarian +
+
+
+ + + + + + + + + + diff --git a/old-source/transfer_barang/transfer_fedit.php b/old-source/transfer_barang/transfer_fedit.php new file mode 100644 index 0000000..a7f1fae --- /dev/null +++ b/old-source/transfer_barang/transfer_fedit.php @@ -0,0 +1,230 @@ + + + + + :: Pengadaan Barang + + + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ Transfer Barang - Edit + + + + + + + + + + + + + + + + + + + + +
ID Transfer: + + No.Faktur Transfer:
Tanggal Transfer: + Toko Asal:
Diskon: %Toko Tujuan:
Total Oper:
Jumlah Item Oper:
+
+ + + + + + + + + + + +
KODE BARANGKODE ASLINAMA BARANGNOMORHARGA SATUAN BELISTOK KOMPJML TRANSFER
+
+
+ + + + + +
+
+
+
+ +
+ + +
+

+
+ +
+

+
+ +
+ + + + + + + + +
ID Transfer:
Rentang Tanggal: + s/d + +
+
+ Hasil pencarian +
+
+
+ + +
+ + + + + + + +
Kode Barang:
Nama Barang:
+
+ Hasil pencarian +
+
+
+ + + + + + + + + diff --git a/old-source/transfer_barang/transfer_fprint.php b/old-source/transfer_barang/transfer_fprint.php new file mode 100644 index 0000000..b78653b --- /dev/null +++ b/old-source/transfer_barang/transfer_fprint.php @@ -0,0 +1,195 @@ + + + + + :: Pengadaan Barang + + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ Transfer Barang - Print + + + + + + + + + + + + + + + + + + + + +
ID Transfer: + + No.Faktur Transfer:
Tanggal Transfer: Toko Asal:
Diskon: %Toko Tujuan:
Total Oper:
Jumlah Item Oper:
+
+ + + + + + + + + + + +
+
+ +
+
+
+
+ +
+ + +
+

+
+ +
+

+
+ +
+ + + + + + + + +
ID Transfer:
Rentang Tanggal: + s/d + +
+
+ Hasil pencarian +
+
+
+ + + + + + + diff --git a/old-source/transfer_barang/transfer_hapus.php b/old-source/transfer_barang/transfer_hapus.php new file mode 100644 index 0000000..dccdb02 --- /dev/null +++ b/old-source/transfer_barang/transfer_hapus.php @@ -0,0 +1,31 @@ +prepare("DELETE FROM d_transfer WHERE id_transfer = ? AND kode_barang_nota = ? AND jumlah = ? AND harga_satuan = ? AND nomor = ? LIMIT 1"); + $stmt->bind_param("isiis",$transfer_id, $kode, $jumlah, $harga, $no); + $stmt->execute(); + if($stmt->affected_rows > 0) $hasil = 1; + else $hasil = 0; + $stmt->close(); + } + $harray = array('hasil' => $hasil); + echo json_encode($harray); +} +/* end file */ \ No newline at end of file diff --git a/old-source/transfer_barang/transfer_kembali.php b/old-source/transfer_barang/transfer_kembali.php new file mode 100644 index 0000000..6eb2386 --- /dev/null +++ b/old-source/transfer_barang/transfer_kembali.php @@ -0,0 +1,224 @@ + + + + + :: Pengadaan Barang + + + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ Transfer Barang - Kembali + + + + + + + + + + + + + + + + + + + + +
ID Transfer: + + No.Faktur Transfer:
Tanggal Transfer: + Toko Asal:
Diskon: %Toko Tujuan:
Total Kembali:
Jumlah Item Kembali:
+
+ + + + + + + + + + +
KODE BARANGNAMA BARANGNOMORHARGA SATUAN BELISTOK KOMPJML TRANSFERJML BRG KEMBALI
+
+
+ + + +
+
+
+
+ +
+ + +
+

+
+ +
+

+
+ +
+ + + + + + + + +
ID Transfer:
Rentang Tanggal: + s/d + +
+
+ Hasil pencarian +
+
+
+ + +
+ + + + + + + +
Kode Barang:
Nama Barang:
+
+ Hasil pencarian +
+
+
+ + + + + + + + + diff --git a/old-source/transfer_barang/transfer_print.php b/old-source/transfer_barang/transfer_print.php new file mode 100644 index 0000000..0a5e742 --- /dev/null +++ b/old-source/transfer_barang/transfer_print.php @@ -0,0 +1,165 @@ +query("SELECT d.jumlah, d.kode_barang_nota, b.nama_barang, d.nomor, d.harga_satuan, d.jumlah * d.harga_satuan as jum, + d.kd_supplier,s.nama_supplier,d.no_nota + FROM d_transfer d, barang b,supplier s + WHERE d.kode_barang_nota = b.kode_barang + AND d.kd_supplier = s.kd_supplier + AND d.id_transfer = $_POST[idtransfer]"); + + $tabledetil = "" + . "" + . "" + . "" + . "" + . "" + . "" + . "" + . "" + . "" + . ""; + + if($transferdata->num_rows > 0) + { + $subtotal = 0; + while($a = $transferdata->fetch_array(MYSQLI_ASSOC)) + { + $tabledetil .= "" + . "" + . "" + . "" + . "" + . "" + . "" + . "" + . "" + . ""; + + $subtotal += $a['jum']; + $vol += $a['jumlah']; + } + $jdiskon = $subtotal*($_POST['diskon']/100); + $tabledetil .= "" + . "" + . "" + . ""; + $tabledetil .= "" + . "" + . ""; + $tabledetil .= "" + . "" + . ""; + + /* tutup hasil query */ + $transferdata->close(); + } + $tabledetil .= "
Jml BarangKd BarangNama BarangNomorKd SuppNama SuppNo FakturHarga SatuanJumlah
".$a['jumlah']."".$a['kode_barang_nota']."".$a['nama_barang']."".$a['nomor']."".$a['kd_supplier']."".$a['nama_supplier']."".$a['no_nota']."".number_format($a['harga_satuan'],0,',','.')."".number_format($a['jum'],0,',','.')." 
".$vol."Sub Total  ".number_format($subtotal,0,',','.')." 
Disc. ".$_POST['diskon']." %  ".number_format($jdiskon,0,',','.')." 
Netto  ".number_format(($subtotal-$jdiskon),0,',','.')." 
"; + echo ""; + echo ""; + + /*lembar 1***************************************************************************************************/ + echo "
"; + echo "

"; + echo "
"; + echo "
"; + echo " "; + echo "
DARI TOKO:". $_POST['tokoasal'] ."
OPER KE:".$_POST['tokotujuan']."
"; + echo "
"; + echo " "; + echo " "; + echo "
NO.FAKTUR OPER:". $_POST['fakturoper'] ."
TANGGAL NOTA:". $_POST['tgltransfer'] ."
"; + echo "


"; + echo $tabledetil; + echo "
"; + echo "
"; + + /*lembar 2***************************************************************************************************/ + echo "
"; + echo "

"; + echo "
"; + echo "
"; + echo " "; + echo "
DARI TOKO:". $_POST['tokoasal'] ."
OPER KE:".$_POST['tokotujuan']."
"; + echo "
"; + echo " "; + echo " "; + echo "
NO.FAKTUR OPER:". $_POST['fakturoper'] ."
TANGGAL NOTA:". $_POST['tgltransfer'] ."
"; + echo "


"; + echo $tabledetil; + echo "
"; + echo "
"; + + /*lembar 3***************************************************************************************************/ + echo "
"; + echo "

"; + echo "
"; + echo "
"; + echo " "; + echo "
DARI TOKO:". $_POST['tokoasal'] ."
OPER KE:".$_POST['tokotujuan']."
"; + echo "
"; + echo " "; + echo " "; + echo "
NO.FAKTUR OPER:". $_POST['fakturoper'] ."
TANGGAL NOTA:". $_POST['tgltransfer'] ."
"; + echo "


"; + echo $tabledetil; + echo "
"; + echo "
"; + + } +} +?> \ No newline at end of file diff --git a/old-source/transfer_barang/transfer_simpan.php b/old-source/transfer_barang/transfer_simpan.php new file mode 100644 index 0000000..ced26ef --- /dev/null +++ b/old-source/transfer_barang/transfer_simpan.php @@ -0,0 +1,91 @@ + $kode[$id], 'nomor' => $no_barang[$id], 'kodeasli' => $kodeasli[$id], 'hb' => $hb_satuan[$id], 'jumlah' => $jumlah[$id], 'kodesupp' => $kd_supplier[$id], 'nofaktur' => $no_faktur[$id]); + + // urutkan datanya + sort($aDataTransfer); + + // proses penggabungan data yang sama + $aHasil = array(); + $co = 0; + $c=0; + for ($i=0;$iprepare("INSERT INTO m_transfer(tgl_transfer, toko_asal, toko_tujuan, diskon, jml_item, total_transfer) + VALUES (?, ?, ?, ?, ?, ?)"); + $stmt->bind_param("sssiii", $tgl_transfer, $tokoasal, $tokotujuan, $diskon, $jml_oper, $tot_oper); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = 1; + $transfer_id = $mysqli->insert_id; + } + else $hasil = 0; + $stmt->close(); + + // isi table detil transfer + for($i=0; $iprepare("INSERT INTO d_transfer(id_transfer, kode_barang_nota, jumlah, harga_satuan, nomor, kd_supplier, no_nota) + VALUES (?,?,?,?,?,?,?)"); + $stmt->bind_param("isiisss",$transfer_id, $aHasil[$i]['kode'], $aHasil[$i]['jumlah'], $aHasil[$i]['hb'], $aHasil[$i]['nomor'], $aHasil[$i]['kodesupp'], $aHasil[$i]['nofaktur']); + $stmt->execute(); + if($stmt->affected_rows > 0) $hasil = 1; + else $hasil = 0; + $stmt->close(); + } + } + + $harray = array('hasil' => $hasil, 'id_transfer' => $transfer_id); + echo json_encode($harray); +} \ No newline at end of file diff --git a/old-source/transfer_barang/transfer_simpan_kembali.php b/old-source/transfer_barang/transfer_simpan_kembali.php new file mode 100644 index 0000000..6fb9b7d --- /dev/null +++ b/old-source/transfer_barang/transfer_simpan_kembali.php @@ -0,0 +1,94 @@ + $kode[$id], 'nomor' => $no_barang[$id], 'kodeasli' => $kodeasli[$id], 'hb' => $hb_satuan[$id], 'jumlah' => $jumlah[$id], 'kodesupp' => $kd_supplier[$id], 'nofaktur' => $no_faktur[$id]); + + // urutkan datanya + sort($aDataTransfer); + + // proses penggabungan data yang sama + $aHasil = array(); + $co = 0; + $c=0; + for ($i=0;$iprepare("INSERT INTO m_transfer_kembali(tgl_transfer, tgl_kembali, toko_asal, toko_tujuan, diskon, jml_item, total_transfer, faktur_oper) + VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); + $stmt->bind_param("ssssiiis", $tgl_transfer, $tgl_kembali, $tokoasal, $tokotujuan, $diskon, $jml_oper, $tot_oper, $faktur_oper); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = 1; + $transfer_id = $mysqli->insert_id; + } + else $hasil = 0; + $stmt->close(); + + // isi table detil transfer + for($i=0; $iprepare("INSERT INTO d_transfer_kembali(id_transfer, kode_barang_nota, jumlah, harga_satuan, nomor, kd_supplier, no_nota) + VALUES (?,?,?,?,?,?,?)"); + $stmt->bind_param("isiisss",$transfer_id, $aHasil[$i]['kode'], $aHasil[$i]['jumlah'], $aHasil[$i]['hb'], $aHasil[$i]['nomor'], $aHasil[$i]['kodesupp'], $aHasil[$i]['nofaktur']); + $stmt->execute(); + if($stmt->affected_rows > 0) $hasil = 1; + else $hasil = 0; + $stmt->close(); + } + } + + $harray = array('hasil' => $hasil, 'id_transfer' => $transfer_id); + echo json_encode($harray); +} \ No newline at end of file diff --git a/old-source/transfer_barang/transfer_update.php b/old-source/transfer_barang/transfer_update.php new file mode 100644 index 0000000..86b4458 --- /dev/null +++ b/old-source/transfer_barang/transfer_update.php @@ -0,0 +1,132 @@ +prepare("UPDATE m_transfer SET tgl_transfer = ? , toko_tujuan = ?, diskon = ?, jml_item = ?, total_transfer = ? + WHERE id_transfer = ?"); + $stmt->bind_param("ssiiii", $tgl_transfer, $tokotujuan, $diskon, $jml_oper, $tot_oper, $transfer_id); + $stmt->execute(); + if($stmt->affected_rows > 0) $hasilmaster = 1; + else $hasilmaster = 0; + $stmt->close(); + + // begin update data table detail <-- + $aDataBaru = array(); + // masukkan semua data baru dalam satu array + for($id=0; $id $kode[$id], 'nomor' => $no_barang[$id], 'kodeasli' => $kodeasli[$id], 'hb' => $hb_satuan[$id], 'jumlah' => $jumlah[$id], 'kodesupp' => $kd_supplier[$id], 'nofaktur' => $no_faktur[$id] ); + + // urutkan datanya + sort($aDataBaru); + // proses penggabungan data yang sama + + $aBaru = array(); + $co = 0; + $c=0; + for ($i=0;$iquery("SELECT kode_barang_nota + FROM d_transfer + WHERE id_transfer = $transfer_id + AND kode_barang_nota = '$k' + AND harga_satuan = $h + AND nomor = '$n'"); + if($dt->num_rows > 0) + { + $a = $dt->fetch_array(MYSQLI_NUM); + $stmt = $mysqli->prepare("UPDATE d_transfer SET jumlah = ? WHERE id_transfer = ? AND kode_barang_nota = ? AND harga_satuan = ? AND nomor = ?"); + $stmt->bind_param("iisis", $aBaru[$x]['jumlah'], $transfer_id, $aBaru[$x]['kode'], $aBaru[$x]['hb'], $aBaru[$x]['nomor']); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasild = 1; + } + else + { + $hasild = 0; + } + $stmt->close(); + /* tutup hasil query */ + $dt->close(); + }else{ + // jika data belum ada, insert data baru. + $stmt = $mysqli->prepare("INSERT INTO d_transfer(id_transfer, kode_barang_nota, jumlah, harga_satuan, nomor, kd_supplier, no_nota) + VALUES (?,?,?,?,?,?,?)"); + $stmt->bind_param("isiisss",$transfer_id, $aBaru[$x]['kode'], $aBaru[$x]['jumlah'], $aBaru[$x]['hb'], $aBaru[$x]['nomor'], $aBaru[$x]['kodesupp'], $aBaru[$x]['nofaktur']); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasild = 1; + } + else + { + $hasild = 0; + } + + $stmt->close(); + } + } + // --> end update data table detail + } + $mysqli->close(); +// $harray = array('hasilmaster' => $hasilmaster, 'hasild' => $hasild, 'id_transfer' => $transfer_id); + $harray = array($aBaru); + echo json_encode($harray); +} + +/* end file */ diff --git a/old-source/transfer_barang/transfer_validasi.php b/old-source/transfer_barang/transfer_validasi.php new file mode 100644 index 0000000..a7bc738 --- /dev/null +++ b/old-source/transfer_barang/transfer_validasi.php @@ -0,0 +1,69 @@ +prepare("UPDATE m_transfer SET faktur_oper = ?, validasi = '1' WHERE id_transfer = ?"); + $stmt->bind_param("si",$faktur_oper, $id_transfer); + $stmt->execute(); + if($stmt->affected_rows > 0) + $hasil = 1; + else $hasil = 0; + $stmt->close(); + + // ambil barang yang akan diupdate stok nya. + $barang = array(); + $dataBarang = $mysqli->query("SELECT dt.jumlah, dt.nomor, br.id_gabungan + FROM d_transfer dt, m_transfer mt, barang br, no_barang n + WHERE dt.id_transfer = mt.id_transfer + AND br.id_gabungan = n.id_gabungan + AND (dt.kode_barang_nota = br.kode_barang AND dt.nomor = n.nomor) + AND mt.id_transfer = $id_transfer + AND mt.validasi = '1' + "); + $jumBarang = $dataBarang->num_rows; + if($jumBarang > 0) + { + $idx = 0; + while($db = $dataBarang->fetch_array(MYSQLI_ASSOC)) + { + $barang[$idx] = array('id_gabungan' => $db['id_gabungan'], 'jumlah' => $db['jumlah'], 'nomor' => $db['nomor']); + $idx++; + } + /* tutup hasil query */ + $dataBarang->close(); + } + // update stok + for($i=0; $i<$jumBarang; $i++) + { + // update stok barang + $stmt = $mysqli->prepare("UPDATE no_barang SET stok = stok-? WHERE id_gabungan = ? AND nomor = ?"); + $stmt->bind_param("iss",$barang[$i]['jumlah'], $barang[$i]['id_gabungan'], $barang[$i]['nomor']); + $stmt->execute(); + if($stmt->affected_rows > 0) + $hasil = 1; + else + $hasil = 0; + $stmt->close(); + } + + } + $harray = array('hasil' => $hasil); + echo json_encode($harray); +} \ No newline at end of file diff --git a/old-source/transfer_barang/transfer_validasi_kembali.php b/old-source/transfer_barang/transfer_validasi_kembali.php new file mode 100644 index 0000000..b27e5b4 --- /dev/null +++ b/old-source/transfer_barang/transfer_validasi_kembali.php @@ -0,0 +1,66 @@ +prepare("UPDATE m_transfer_kembali SET validasi = '1' WHERE faktur_oper = ?"); + $stmt->bind_param("s", $faktur_oper); + $stmt->execute(); + if($stmt->affected_rows > 0) + $hasil = 1; + else + $hasil = 0; + $stmt->close(); + + // ambil barang yang akan diupdate stok nya. + $barang = array(); + $dataBarang = $mysqli->query("SELECT dt.jumlah, dt.nomor, br.id_gabungan + FROM d_transfer_kembali dt, m_transfer_kembali mt, barang br, no_barang n + WHERE dt.id_transfer = mt.id_transfer + AND br.id_gabungan = n.id_gabungan + AND (dt.kode_barang_nota = br.kode_barang AND dt.nomor = n.nomor) + AND mt.id_transfer = $id_transfer + AND mt.validasi = '1' + "); + $jumBarang = $dataBarang->num_rows; + if($jumBarang > 0) + { + $idx = 0; + while($db = $dataBarang->fetch_array(MYSQLI_ASSOC)) + { + $barang[$idx] = array('id_gabungan' => $db['id_gabungan'], 'jumlah' => $db['jumlah'], 'nomor' => $db['nomor']); + $idx++; + } + /* tutup hasil query */ + $dataBarang->close(); + } + // update stok + for($i=0; $i<$jumBarang; $i++) + { + // update stok barang + $stmt = $mysqli->prepare("UPDATE no_barang SET stok = stok+? WHERE id_gabungan = ? AND nomor = ?"); + $stmt->bind_param("iss",$barang[$i]['jumlah'], $barang[$i]['id_gabungan'], $barang[$i]['nomor']); + $stmt->execute(); + $stmt->close(); + } + + } + $harray = array('hasil' => $hasil); + echo json_encode($harray); +} \ No newline at end of file diff --git a/old-source/ubah_hp/ajaxsupplier.php b/old-source/ubah_hp/ajaxsupplier.php new file mode 100644 index 0000000..6393c13 --- /dev/null +++ b/old-source/ubah_hp/ajaxsupplier.php @@ -0,0 +1,134 @@ + +prepare($query); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + //echo count($array_data); + echo json_encode($array_data); + } +} + +function cari_supplier($nama) { + if($nama != "") { + $harray = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $nama = addslashes($nama); + $data = $mysqli->query("SELECT kd_supplier, nama_supplier, alamat1, lama_tempo FROM supplier WHERE nama_supplier LIKE '%".$nama."%'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_supplier' => $a['kd_supplier'], + 'nama_supplier' => stripcslashes($a['nama_supplier']), + 'alamat1' => $a['alamat1'], + 'lama_tempo' => $a['lama_tempo'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + }else{ + $harray = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $nama = addslashes($nama); + $data = $mysqli->query("SELECT kd_supplier, nama_supplier, alamat1, lama_tempo FROM supplier"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $harray[$idx] = array( + 'kd_supplier' => $a['kd_supplier'], + 'nama_supplier' => stripcslashes($a['nama_supplier']), + 'alamat1' => $a['alamat1'], + 'lama_tempo' => $a['lama_tempo'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); + } +} + +function ambil_supplier($id_supplier) { + if ($id_supplier != "") { + $array_data = array(); + require_once '../db_login.inc.php'; + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT * FROM supplier WHERE kd_supplier = '".$id_supplier."'"); + if($data->num_rows > 0) { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) { + $array_data[$idx] = array( + 'kd_supplier' => $a['kd_supplier'], + 'nama_supplier' => $a['nama_supplier'], + 'alamat1' => $a['alamat1'], + 'alamat2' => $a['alamat2'], + 'nama_rekening' => $a['nama_rekening'], + 'rekening1' => $a['rekening1'], + 'rekening2' => $a['rekening2'], + 'bank1' => $a['bank1'], + 'bank2' => $a['bank2'], + 'telp' => $a['telp'], + 'ponsel' => $a['ponsel'], + 'email' => $a['email'], + 'fax' => $a['fax'], + 'jns_pembayaran' => $a['jns_pembayaran'], + 'lama_tempo' => $a['lama_tempo'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($array_data); + } +} + + +?> \ No newline at end of file diff --git a/old-source/ubah_hp/fungsi_ubah_hp.php b/old-source/ubah_hp/fungsi_ubah_hp.php new file mode 100644 index 0000000..a3d28c9 --- /dev/null +++ b/old-source/ubah_hp/fungsi_ubah_hp.php @@ -0,0 +1,619 @@ + ".$kd_supplier.")"; + $stmt = $mysqli->prepare("INSERT INTO m_pembelian ( + `no_faktur`, + `tgl_nota`, + `tgl_masuk`, + `no_order`, + `tgl_jatuh_tempo`, + `kd_supplier`, + `status`, + `diskon`, + `nik`, + `rp_beli`, + `total_beli`, + `validasi`, + `keterangan`, + `tgl_entry`, + `referensi`, + `status_revisi`) VALUES + ('$norhp', now(), now(), '-', now(), '$kd_supplier', 'T', 0, '$nik', '$rpbeli', 0, '1', '$ket', now(), '$kd_supplier', '$statusrvb')"); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} + +function insert_d_pembelian($norhp, $kode_barang, $kode_lama, $nomor, $stok, $stokrev, $hplama, $hjlama, $hpbaru, $hjbaru, $nama, $idgabungan) +{ + $hasil = FALSE; + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if(!mysqli_connect_errno()) + { + for ($i = 0; $i < count($kode_barang); $i++) + { + /* insert data lama */ + $hplm = $hplama[$i]; + $hrgPlama = convHrgP($hplama[$i]); + $profitlama = round((($hjlama[$i] - $hplm) / $hplm) * 100); + $stoklama = -1 * $stok[$i]; + //$faktur_asli = get_kode_faktur_asli($kode_barang[$i]); + $stmt = $mysqli->prepare("INSERT INTO d_pembelian( + `id`, + `no_faktur`, + `kode_barang`, + `nomor`, + `harga_satuan`, + `harga_pokok`, + `diskon`, + `diskonrp`, + `ppn`, + `profit`, + `kode_asli`, + `jum_fisik`, + `lokasi`, + `hj_final`, + `nm_brg`) + VALUES (NULL,'$norhp','$kode_barang[$i]','$nomor[$i]','$hjlama[$i]','$hrgPlama','0','0','0','$profitlama','$kode_lama[$i]','$stoklama', '1A',' $hjlama[$i]','$nama[$i]')"); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + + /* insert data baru */ + if ($hasil) + { + $hpbr = $hpbaru[$i]; + $hrgPbaru = convHrgP($hpbaru[$i]); + $profitbaru = round((($hjbaru[$i] - $hpbr) / $hpbr) * 100); + $stmt = $mysqli->prepare("INSERT INTO d_pembelian(`id`, + `no_faktur`, + `kode_barang`, + `nomor`, + `harga_satuan`, + `harga_pokok`, + `diskon`, + `diskonrp`, + `ppn`, + `profit`, + `kode_asli`, + `jum_fisik`, + `lokasi`, + `hj_final`, + `nm_brg`) + VALUES (NULL,'$norhp','$kode_barang[$i]','$nomor[$i]','$hjbaru[$i]','$hrgPbaru','0','0','0','$profitbaru','$kode_lama[$i]',' $stokrev[$i]', '1A',' $hjbaru[$i]','$nama[$i]')"); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* update barang*/ + if ($hasil) + { + $update2 = update_barang($idgabungan[$i], $nama[$i]); + if($update2) + { + $hasil = TRUE; + } else + { + $hasil = FALSE; + } + } + + /* update no_barang*/ + if ($hasil) + { + $update = update_no_barang($idgabungan[$i], $nomor[$i], $hrgPbaru, $hjbaru[$i], $stokrev[$i]); + if($update) + { + $hasil = TRUE; + } else + { + $hasil = FALSE; + } + } + $faktur_asli = ""; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} + +/** + * + * @param $id + * @param $nomor + * @param $hp + * @param $hj + * @return unknown_type + */ +function update_no_barang($id, $nomor, $hp, $hj, $stokrev) +{ + $hasil = FALSE; + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if(!mysqli_connect_errno()) + { + // isi table master + $stmt = $mysqli->prepare("UPDATE no_barang SET stok = ?,harga_pokok = ?, harga_jual = ? WHERE id_gabungan = ? AND nomor = ?"); + $stmt->bind_param("isiss", $stokrev, $hp, $hj, $id, $nomor); + $stmt->execute(); + if($stmt->affected_rows >= 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} + +function update_barang($id, $nama) +{ + $hasil = FALSE; + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if(!mysqli_connect_errno()) + { + // isi table master + $stmt = $mysqli->prepare("UPDATE barang SET nama_barang = ? WHERE id_gabungan = ?"); + $stmt->bind_param("ss", $nama, $id); + $stmt->execute(); + if($stmt->affected_rows >= 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} +/** + * + * @param $kdsupplier + * @return unknown_type + */ +function get_no_rhp($kdsupplier) +{ + $urutbaru = 0; + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if(cek_data($kdsupplier)) + { + $data_faktur = $mysqli->query("SELECT MAX(RIGHT(no_faktur, 3)) FROM m_pembelian WHERE LEFT(no_faktur, 10) = 'RVB-{$kdsupplier}'"); + if($data_faktur->num_rows > 0) + { + $urut = $data_faktur->fetch_array(); + $urutbaru = (int)$urut[0] + 1; + if(strlen($urutbaru) == 1) + { + $urutbaru = "00".$urutbaru; + } + if(strlen($urutbaru) == 2) + { + $urutbaru = "0".$urutbaru; + } + $data_faktur->close(); + } + } else { + $urutbaru = "000"; + } + $hasil[0] = "RVB-".$kdsupplier."-".$urutbaru; + echo json_encode($hasil); + $mysqli->close(); +} + +/** + * + * @param $kodesupplier + * @return unknown_type + */ +function cek_data($kodesupplier) +{ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT COUNT(*) FROM m_pembelian WHERE LEFT(no_faktur, 10) = 'RVB-{$kodesupplier}'"); + $dt = $data->fetch_array(); + if($dt[0] > 0) + { + return true; + } else + { + return false; + } + $data->close(); + $mysqli->close(); +} + +/** + * + * @param $kode + * @param $nomor + * @param $kd_supplier + * @return unknown_type + */ +function ambil_barang($kode, $nomor) +{ + if($kode != "" || $nomor != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if($nomor != "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.kode_lama, brg.nama_barang, brg.id_gabungan, nb.stok, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, supplier s, d_pembelian dp + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND (brg.kode_barang = '{$kode}' OR brg.kode_lama = '{$kode}') AND nb.nomor = '{$nomor}' + AND brg.kode_supplier = s.kd_supplier LIMIT 1"); + } else if($nomor == "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.kode_lama, brg.nama_barang, brg.id_gabungan, nb.stok, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, supplier s, d_pembelian dp + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND (brg.kode_barang = '{$kode}' OR brg.kode_lama = '{$kode}') + AND brg.kode_supplier = s.kd_supplier LIMIT 1"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('kode_barang' => $a['kode_barang'], 'kode_lama' => $a['kode_lama'], 'nama_barang' => $a['nama_barang'], + 'supplier' => $a['nama_supplier'], 'id_gabungan' => $a['id_gabungan'], 'stok' => $a['stok'], + 'kd_supplier' => $a['kode_supplier'], 'hp' => $a['harga_pokok'], 'hj' => $a['harga_jual'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kode + * @param $nomor + * @param $kd_supplier + * @return unknown_type + */ +function cek_barang($kode, $nomor) +{ + if($kode != "" || $nomor != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if($nomor != "") + { + $data = $mysqli->query("SELECT count(*) + FROM barang brg, no_barang nb, d_pembelian dp + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND (brg.kode_barang = '{$kode}' OR brg.kode_lama = '{$kode}') AND nb.nomor = '{$nomor}' + "); + } else if($nomor == "") { + $data = $mysqli->query("SELECT count(*) + FROM barang brg + WHERE (brg.kode_barang = '{$kode}' OR brg.kode_lama = '{$kode}')"); + } + if($data->num_rows > 0) + { + $jum = $data->fetch_array(); + if($jum[0] > 0) + { + $harray[0] = "true"; + } else + { + $harray[0] = "false"; + } + /* tutup hasil query */ + $data->close(); + } else + { + $harray[0] = "false"; + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kode + * @param $nama + * @param $kd_supplier + * @return unknown_type + */ +function cari_barang($kode, $nama) +{ + if($kode != "" || $nama != "") + { + $harray = array(); + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if($nama != "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.nama_barang, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, d_pembelian dp, supplier s + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang AND brg.kode_supplier = s.kd_supplier + AND (brg.kode_lama LIKE '{$kode}%' OR brg.kode_barang LIKE '{$kode}%') AND brg.nama_barang LIKE '%{$nama}%' + "); + } else if($nama == "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.nama_barang, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, d_pembelian dp, supplier s + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang AND brg.kode_supplier = s.kd_supplier + AND (brg.kode_lama LIKE '{$kode}%' OR brg.kode_barang LIKE '{$kode}%') + "); + } + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'], 'nama_barang' => $a['nama_barang'], 'supplier' => $a['nama_supplier'], + 'kd_supplier' => $a['kode_supplier'], 'hp' => $a['harga_pokok'], 'hj' => $a['harga_jual'] + ); + $idx++; + } + $data->close(); + } + $mysqli->close(); + } + echo json_encode($harray); +} + +/** + * + * @param $kode + * @param $nama + * @return unknown_type + */ +function get_supplier($kode, $nama) +{ + if($kode != "" || $nama != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + if($nama != "") + { + $data = $mysqli->query("SELECT s.kd_supplier, s.nama_supplier + FROM supplier s + WHERE s.kd_supplier LIKE '%{$kode}%' AND s.nama_supplier LIKE '%{$nama}%'"); + } else if($nama == "") + { + $data = $mysqli->query("SELECT s.kd_supplier, s.nama_supplier + FROM supplier s + WHERE s.kd_supplier LIKE '%{$kode}%'"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('kode_supplier' => $a['kd_supplier'], 'nama_supplier' => $a['nama_supplier']); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kodebarang + * @return unknown_type + */ +function get_kode_faktur_asli($kodebarang) +{ + $faktur = ""; + if($kodebarang != "" ) + { + /* konfigurasi untuk koneksi ke database */ + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $data = $mysqli->query("SELECT d.no_faktur FROM d_pembelian d WHERE d.kode_barang = '{$kodebarang}'"); + if($data->num_rows > 0) + { + $faktur = $data->fetch_array(MYSQLI_NUM); + $faktur = $faktur[0]; + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + return $faktur; +} +/** + * + * @param $data + * @return unknown_type + */ +function hitung_total_hp($data, $stok) +{ + $total = 0; + for ($i = 0; $i < count($data); $i++) + { + //$total += decode_hp($data[$i]) * $stok[$i]; + $total += $data[$i] * $stok[$i]; + } + return $total; +} + +/** + * + * @param $hp + * @return int hasil decode + */ +function decode_hp($hp) +{ + $dt = ""; + for($i = 0; $i < strlen($hp); $i++) + { + $chr = substr($hp, $i, 1); + switch($chr) + { + case "B" : $dt .= "1";break; + case "R" : $dt .= "2";break; + case "A" : $dt .= "3";break; + case "W" : $dt .= "4";break; + case "N" : $dt .= "5";break; + case "F" : $dt .= "6";break; + case "O" : $dt .= "7";break; + case "X" : $dt .= "8";break; + case "E" : $dt .= "9";break; + case "S" : $dt .= "0";break; + } + } + return (int) $dt; +} + +function convHrgP($hrgP){ + $kode = ""; + for($i=0;$i \ No newline at end of file diff --git a/old-source/ubah_hp/fungsi_ubah_hp.php~ b/old-source/ubah_hp/fungsi_ubah_hp.php~ new file mode 100644 index 0000000..22ce241 --- /dev/null +++ b/old-source/ubah_hp/fungsi_ubah_hp.php~ @@ -0,0 +1,563 @@ +prepare("INSERT INTO m_pembelian VALUES (?, now(), now(), '-', now(), ?, 'T', 0, ?, ?, 0, '1', 'Revisi Barang', now(), ?, ?)"); + $stmt->bind_param("sssiss", $norhp, $kd_supplier, $nik, $rpbeli, $nofaktur, $statusrvb); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} + +function insert_d_pembelian($norhp, $kode_barang, $kode_lama, $nomor, $stok, $stokrev, $hplama, $hjlama, $hpbaru, $hjbaru, $nama, $idgabungan) +{ + $hasil = FALSE; + /* konfigurasi untuk koneksi ke database */ + require_once("../konfig/konfig_db.inc.php"); + $mysqli = new mysqli(NAMA_HOST, NAMA_USER, PASSWORD, NAMA_DB); + if(!mysqli_connect_errno()) + { + for ($i = 0; $i < count($kode_barang); $i++) + { + /* insert data lama */ + $hplm = decode_hp($hplama[$i]); + $profitlama = ceil((($hjlama[$i] - $hplm) / $hplm) * 100); + $stoklama = -1 * $stok[$i]; + $faktur_asli = get_kode_faktur_asli($kode_barang[$i]); + $stmt = $mysqli->prepare("INSERT INTO d_pembelian(no_faktur, kode_barang, kode_baranglama, nomor, jumlah, harga_satuan, harga_pokok, harga_jual, profit, kode_asli, jum_fisik, jenis, lokasi, hj_final, nm_brg) + VALUES (?, ?, ?, ?, ?, 0, ?, ?, ?, '-', ?, 'S', '1A', ?, ?)"); + $stmt->bind_param("ssssisiiiis", $norhp, $kode_barang[$i], $kode_lama[$i], $nomor[$i], $stoklama, $hplama[$i], $hjlama[$i], $profitlama, $stoklama, $hjlama[$i], $nama[$i]); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + + /* insert data baru */ + if ($hasil) + { + $hpbr = decode_hp($hpbaru[$i]); + $profitbaru = ceil((($hjbaru[$i] - $hpbr) / $hpbr) * 100); + $stmt = $mysqli->prepare("INSERT INTO d_pembelian(no_faktur, kode_barang, kode_baranglama, nomor, jumlah, harga_satuan, harga_pokok, harga_jual, profit, kode_asli, jum_fisik, jenis, lokasi, hj_final, nm_brg) + VALUES (?, ?, ?, ?, ?, 0, ?, ?, ?, '-', ?, 'S', '1A', ?, ?)"); + $stmt->bind_param("ssssisiiiis", $norhp, $kode_barang[$i], $kode_lama[$i], $nomor[$i], $stokrev[$i], $hpbaru[$i], $hjbaru[$i], $profitbaru, $stokrev[$i], $hjbaru[$i], $nama[$i]); + $stmt->execute(); + if($stmt->affected_rows > 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* update barang*/ + if ($hasil) + { + $update2 = update_barang($idgabungan[$i], $nama[$i]); + if($update2) + { + $hasil = TRUE; + } else + { + $hasil = FALSE; + } + } + + /* update no_barang*/ + if ($hasil) + { + $update = update_no_barang($idgabungan[$i], $nomor[$i], $hpbaru[$i], $hjbaru[$i], $stokrev[$i]); + if($update) + { + $hasil = TRUE; + } else + { + $hasil = FALSE; + } + } + $faktur_asli = ""; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} + +/** + * + * @param $id + * @param $nomor + * @param $hp + * @param $hj + * @return unknown_type + */ +function update_no_barang($id, $nomor, $hp, $hj, $stokrev) +{ + $hasil = FALSE; + /* konfigurasi untuk koneksi ke database */ + require_once("../konfig/konfig_db.inc.php"); + $mysqli = new mysqli(NAMA_HOST, NAMA_USER, PASSWORD, NAMA_DB); + if(!mysqli_connect_errno()) + { + // isi table master + $stmt = $mysqli->prepare("UPDATE no_barang SET stok = ?,harga_pokok = ?, harga_jual = ? WHERE id_gabungan = ? AND nomor = ?"); + $stmt->bind_param("isiss", $stokrev, $hp, $hj, $id, $nomor); + $stmt->execute(); + if($stmt->affected_rows >= 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} + +function update_barang($id, $nama) +{ + $hasil = FALSE; + /* konfigurasi untuk koneksi ke database */ + require_once("../konfig/konfig_db.inc.php"); + $mysqli = new mysqli(NAMA_HOST, NAMA_USER, PASSWORD, NAMA_DB); + if(!mysqli_connect_errno()) + { + // isi table master + $stmt = $mysqli->prepare("UPDATE barang SET nama_barang = ? WHERE id_gabungan = ?"); + $stmt->bind_param("ss", $nama, $id); + $stmt->execute(); + if($stmt->affected_rows >= 0) + { + $hasil = TRUE; + $stmt->close(); + } else + { + $hasil = FALSE; + } + } + /* tutup koneksi */ + $mysqli->close(); + return $hasil; +} +/** + * + * @param $kdsupplier + * @return unknown_type + */ +function get_no_rhp($kdsupplier) +{ + $urutbaru = 0; + /* konfigurasi untuk koneksi ke database */ + require_once("../konfig/konfig_db.inc.php"); + $mysqli = new mysqli(NAMA_HOST, NAMA_USER, PASSWORD, NAMA_DB); + // cek ada atau tidak + if(cek_data($kdsupplier)) + { + $data_faktur = $mysqli->query("SELECT MAX(RIGHT(no_faktur, 3)) FROM m_pembelian WHERE LEFT(no_faktur, 10) = 'RVB-{$kdsupplier}'"); + if($data_faktur->num_rows > 0) + { + $urut = $data_faktur->fetch_array(); + $urutbaru = (int)$urut[0] + 1; + if(strlen($urutbaru) == 1) + { + $urutbaru = "00".$urutbaru; + } + if(strlen($urutbaru) == 2) + { + $urutbaru = "0".$urutbaru; + } + /* tutup hasil query */ + $data_faktur->close(); + } + } else + { + $urutbaru = "000"; + } + $hasil[0] = "RVB-".$kdsupplier."-".$urutbaru; + echo json_encode($hasil); + /* tutup koneksi */ + $mysqli->close(); +} + +/** + * + * @param $kodesupplier + * @return unknown_type + */ +function cek_data($kodesupplier) +{ + /* konfigurasi untuk koneksi ke database */ + require_once("../konfig/konfig_db.inc.php"); + $mysqli = new mysqli(NAMA_HOST, NAMA_USER, PASSWORD, NAMA_DB); + // cek ada atau tidak + $data = $mysqli->query("SELECT COUNT(*) FROM m_pembelian WHERE LEFT(no_faktur, 10) = 'RVB-{$kodesupplier}'"); + $dt = $data->fetch_array(); + if($dt[0] > 0) + { + return true; + } else + { + return false; + } + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); +} + +/** + * + * @param $kode + * @param $nomor + * @param $kd_supplier + * @return unknown_type + */ +function ambil_barang($kode, $nomor, $nofaktur) +{ + if($kode != "" || $nomor != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../konfig/konfig_db.inc.php"); + $mysqli = new mysqli(NAMA_HOST, NAMA_USER, PASSWORD, NAMA_DB); + if($nomor != "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.kode_lama, brg.nama_barang, brg.id_gabungan, nb.stok, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, supplier s, d_pembelian dp + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND brg.kode_barang = '{$kode}' AND nb.nomor = '{$nomor}' + AND brg.kode_supplier = s.kd_supplier AND dp.no_faktur = '{$nofaktur}' LIMIT 1"); + } else if($nomor == "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.kode_lama, brg.nama_barang, brg.id_gabungan, nb.stok, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, supplier s, d_pembelian dp + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND brg.kode_barang = '{$kode}' + AND brg.kode_supplier = s.kd_supplier AND dp.no_faktur = '{$nofaktur}' LIMIT 1"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('kode_barang' => $a['kode_barang'], 'kode_lama' => $a['kode_lama'], 'nama_barang' => $a['nama_barang'], + 'supplier' => $a['nama_supplier'], 'id_gabungan' => $a['id_gabungan'], 'stok' => $a['stok'], + 'kd_supplier' => $a['kode_supplier'], 'hp' => $a['harga_pokok'], 'hj' => $a['harga_jual'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kode + * @param $nomor + * @param $kd_supplier + * @return unknown_type + */ +function cek_barang($kode, $nomor, $nofaktur) +{ + if($kode != "" || $nomor != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../konfig/konfig_db.inc.php"); + $mysqli = new mysqli(NAMA_HOST, NAMA_USER, PASSWORD, NAMA_DB); + if($nomor != "") + { + $data = $mysqli->query("SELECT count(*) + FROM barang brg, no_barang nb, d_pembelian dp + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang + AND brg.kode_barang = '{$kode}' AND nb.nomor = '{$nomor}' + AND dp.no_faktur = '{$nofaktur}'"); + } else if($nomor == "") + { + $data = $mysqli->query("SELECT count(*) + FROM barang brg + WHERE brg.kode_barang = '{$kode}'"); + } + if($data->num_rows > 0) + { + $jum = $data->fetch_array(); + if($jum[0] > 0) + { + $harray[0] = "true"; + } else + { + $harray[0] = "false"; + } + /* tutup hasil query */ + $data->close(); + } else + { + $harray[0] = "false"; + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kode + * @param $nama + * @param $kd_supplier + * @return unknown_type + */ +function cari_barang($kode, $nama, $nofaktur) +{ + if($kode != "" || $nama != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../konfig/konfig_db.inc.php"); + $mysqli = new mysqli(NAMA_HOST, NAMA_USER, PASSWORD, NAMA_DB); + if($nama != "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.nama_barang, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, d_pembelian dp, supplier s + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang AND brg.kode_supplier = s.kd_supplier + AND brg.kode_barang LIKE '{$kode}%' AND brg.nama_barang LIKE '%{$nama}%' + AND dp.no_faktur = '{$nofaktur}'"); + } else if($nama == "") + { + $data = $mysqli->query("SELECT DISTINCT brg.kode_barang, brg.nama_barang, nb.harga_pokok, nb.harga_jual, brg.kode_supplier, s.nama_supplier + FROM barang brg, no_barang nb, d_pembelian dp, supplier s + WHERE brg.id_gabungan = nb.id_gabungan AND brg.kode_barang = dp.kode_barang AND brg.kode_supplier = s.kd_supplier + AND brg.kode_barang LIKE '{$kode}%' + AND dp.no_faktur = '{$nofaktur}'"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'], 'nama_barang' => $a['nama_barang'], 'supplier' => $a['nama_supplier'], + 'kd_supplier' => $a['kode_supplier'], 'hp' => $a['harga_pokok'], 'hj' => $a['harga_jual'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kode + * @param $nama + * @return unknown_type + */ +function get_supplier($kode, $nama) +{ + if($kode != "" || $nama != "") + { + $harray = array(); + /* konfigurasi untuk koneksi ke database */ + require_once("../konfig/konfig_db.inc.php"); + $mysqli = new mysqli(NAMA_HOST, NAMA_USER, PASSWORD, NAMA_DB); + if($nama != "") + { + $data = $mysqli->query("SELECT s.kd_supplier, s.nama_supplier + FROM supplier s + WHERE s.kd_supplier LIKE '%{$kode}%' AND s.nama_supplier LIKE '%{$nama}%'"); + } else if($nama == "") + { + $data = $mysqli->query("SELECT s.kd_supplier, s.nama_supplier + FROM supplier s + WHERE s.kd_supplier LIKE '%{$kode}%'"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array('kode_supplier' => $a['kd_supplier'], 'nama_supplier' => $a['nama_supplier']); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} + +/** + * + * @param $kodebarang + * @return unknown_type + */ +function get_kode_faktur_asli($kodebarang) +{ + $faktur = ""; + if($kodebarang != "" ) + { + /* konfigurasi untuk koneksi ke database */ + require_once("../konfig/konfig_db.inc.php"); + $mysqli = new mysqli(NAMA_HOST, NAMA_USER, PASSWORD, NAMA_DB); + $data = $mysqli->query("SELECT d.no_faktur FROM d_pembelian d WHERE d.kode_barang = '{$kodebarang}'"); + if($data->num_rows > 0) + { + $faktur = $data->fetch_array(MYSQLI_NUM); + $faktur = $faktur[0]; + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + return $faktur; +} +/** + * + * @param $data + * @return unknown_type + */ +function hitung_total_hp($data, $stok) +{ + $total = 0; + for ($i = 0; $i < count($data); $i++) + { + $total += decode_hp($data[$i]) * $stok[$i]; + } + return $total; +} + +/** + * + * @param $hp + * @return int hasil decode + */ +function decode_hp($hp) +{ + $dt = ""; + for($i = 0; $i < strlen($hp); $i++) + { + $chr = substr($hp, $i, 1); + switch($chr) + { + case "B" : $dt .= "1";break; + case "R" : $dt .= "2";break; + case "A" : $dt .= "3";break; + case "W" : $dt .= "4";break; + case "N" : $dt .= "5";break; + case "F" : $dt .= "6";break; + case "O" : $dt .= "7";break; + case "X" : $dt .= "8";break; + case "E" : $dt .= "9";break; + case "S" : $dt .= "0";break; + } + } + return (int) $dt; +} +?> \ No newline at end of file diff --git a/old-source/ubah_hp/hmenu.php~ b/old-source/ubah_hp/hmenu.php~ new file mode 100644 index 0000000..8aa3046 --- /dev/null +++ b/old-source/ubah_hp/hmenu.php~ @@ -0,0 +1,128 @@ + diff --git a/old-source/ubah_hp/menu.php b/old-source/ubah_hp/menu.php new file mode 100644 index 0000000..cd103bd --- /dev/null +++ b/old-source/ubah_hp/menu.php @@ -0,0 +1,129 @@ + + + + + +
+ +
diff --git a/old-source/ubah_hp/revisifaktur_fbaru.php b/old-source/ubah_hp/revisifaktur_fbaru.php new file mode 100644 index 0000000..fc9ea4b --- /dev/null +++ b/old-source/ubah_hp/revisifaktur_fbaru.php @@ -0,0 +1,185 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ Revisi Faktur Pembelian + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nomor Faktur: + + Tanggal Nota:
Edit No.Faktur: *Tanggal Revisi:
Status: [(H)utang,(T)unai,(K)onsiyasi] Tanggal Masuk:
Kode Supplier: Tanggal Jth Tempo:
Keterangan NIK:
+ +
+ +
+
+ +
+ + +
+

+
+ +
+

+
+ +
+ + + + + + + + + + + +
Nomor Faktur:
Rentang Tanggal: + s/d + +
Kode Supplier:
+
+ Hasil pencarian +
+
+
+ + + + + + + + diff --git a/old-source/ubah_hp/revisifaktur_simpan.php b/old-source/ubah_hp/revisifaktur_simpan.php new file mode 100644 index 0000000..5fb7f6c --- /dev/null +++ b/old-source/ubah_hp/revisifaktur_simpan.php @@ -0,0 +1,119 @@ + ". $tglrf .")"; + $array_data = array(); + + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $stmt = $mysqli->prepare("UPDATE m_pembelian SET no_faktur=?, tgl_nota=?, tgl_masuk=?, tgl_jatuh_tempo=?, kd_supplier=?, status=?, nik=?, keterangan=? WHERE no_faktur = ?"); + $stmt->bind_param("sssssssss", $nofakturedit, $tglnota, $tglmasuk, $tgljthtempo, $kdsupp, $status, $nik, $ketr, $nofaktur); + $stmt->execute(); + if($stmt->affected_rows > 0) { + $stmt2 = $mysqli->prepare("UPDATE d_pembelian SET no_faktur=? WHERE no_faktur = ?"); + $stmt2->bind_param("ss", $nofakturedit, $nofaktur); + $stmt2->execute(); + update_barang(); + $array_data[0] = 1; + } else { + $array_data[0] = 0; + } + $stmt->close(); + $mysqli->close(); + echo json_encode($array_data); +} + +function update_barang() +{ + $barang = array(); + $kdsupp = $_REQUEST['kodesupplier']; + $nofaktur = $_REQUEST['nofaktur']; + require_once("../db_login.inc.php"); + $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); + $stmt3 = $mysqli->query("SELECT DISTINCT kode_barang FROM d_pembelian WHERE no_faktur = '$nofaktur'"); + $jumBarang = $stmt3->num_rows; + if($jumBarang > 0){ + $idx = 0; + while($db = $stmt3->fetch_array(MYSQLI_ASSOC)) + { + $barang[$idx] = array('kode_barang' => $db['kode_barang']); + $idx++; + } + $stmt3->close(); + } + // update kdsupp + for($i=0; $i<$jumBarang; $i++) + { + $stmt = $mysqli->prepare("UPDATE barang SET kode_supplier = ? WHERE kode_barang = ?"); + $stmt->bind_param("ss",$kdsupp, $barang[$i]['kode_barang']); + $stmt->execute(); + $stmt->close(); + } + $mysqli->close(); +} + + +function hitung_total_hp($data, $stok) +{ + $total = 0; + for ($i = 0; $i < count($data); $i++) + { + $total += $data[$i] * $stok[$i]; + } + return $total; +} + +function decode_hp($hp) +{ + $dt = ""; + for($i = 0; $i < strlen($hp); $i++) + { + $chr = substr($hp, $i, 1); + switch($chr) + { + case "B" : $dt .= "1";break; + case "R" : $dt .= "2";break; + case "A" : $dt .= "3";break; + case "W" : $dt .= "4";break; + case "N" : $dt .= "5";break; + case "F" : $dt .= "6";break; + case "O" : $dt .= "7";break; + case "X" : $dt .= "8";break; + case "E" : $dt .= "9";break; + case "S" : $dt .= "0";break; + } + } + return (int) $dt; +} + +function decTgl($tgl){// ke format yyyy-mm-dd + $d = substr($tgl,0,2); + $m = substr($tgl,3,2); + $y = substr($tgl,6,4); + return $y."-".$m."-".$d; +} \ No newline at end of file diff --git a/old-source/ubah_hp/ubahhp.php b/old-source/ubah_hp/ubahhp.php new file mode 100644 index 0000000..34be868 --- /dev/null +++ b/old-source/ubah_hp/ubahhp.php @@ -0,0 +1,248 @@ + + + + + Cleopatra + + + + + + + + + + + + + + + + + + + + + + + +
+
+

Cleopatra Minimarket

+
+
+ +
+
+
+ Revisi Barang + + + + + + + + + + + + + + + + + + +
Nomor Revisi:
Kode Supplier: + + + NIK:
Nama Supplier: Status Revisi + : +
Keterangan  + (max.100 char) +
+
+ + + + + + + + + + + + +
KODE BARANGNOMORNAMA BARANGSTOKHP LAMAHJ LAMAHP BARUHJ BARU
+
+ + +
+
+
+
+
+ +
+ + +
+

+
+ +
+

+
+ + +
+ + + + + + + + +
Kode Barang:
Nama Barang: + +
+
+ Hasil pencarian +
+
+
+ +
+ + + + + + + + + + + +
Nomor Faktur:
Rentang Tanggal: + s/d + +
Kode Supplier:
+
+ Hasil pencarian +
+
+
+ + + + + +
+
Cari Supplier
+
+ +
+
+ + + + +
Nama:
+
+
+ Hasil pencarian +
+
+
+ +
+ +
+ + + diff --git a/old-source/umum/ambil_barang.php b/old-source/umum/ambil_barang.php new file mode 100644 index 0000000..7415059 --- /dev/null +++ b/old-source/umum/ambil_barang.php @@ -0,0 +1,44 @@ +query("SELECT brg.kode_barang, brg.nama_barang,n.harga_pokok, n.harga_jual, n.stok + FROM barang brg inner join no_barang n on brg.id_gabungan = n.id_gabungan + WHERE n.nomor = '$_REQUEST[nobarang]' + AND brg.kode_barang = '$_REQUEST[idbarang]' + ORDER BY brg.kode_barang"); + } else if(!isset($_REQUEST['nobarang'])){ + $data = $mysqli->query("SELECT brg.kode_barang,brg.nama_barang,n.harga_pokok, n.harga_jual, n.stok + FROM barang brg inner join no_barang n on brg.id_gabungan = n.id_gabungan + WHERE brg.kode_barang = '$_REQUEST[idbarang]' + ORDER BY brg.kode_barang"); + } + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'], 'nama_barang' => $a['nama_barang'], + 'harga_beli' => $a['harga_pokok'], 'harga_jual' => $a['harga_jual'], 'stok' => $a['stok'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/umum/ambil_kode_barang.php b/old-source/umum/ambil_kode_barang.php new file mode 100644 index 0000000..3993ba9 --- /dev/null +++ b/old-source/umum/ambil_kode_barang.php @@ -0,0 +1,51 @@ +query("SELECT DISTINCT d.kode_barang, m.kd_supplier, b.nama_barang, sup.nama_supplier, + m.tgl_nota, m.tgl_masuk, m.tgl_jatuh_tempo, m.status, m.keterangan, m.nik + FROM m_pembelian m, d_pembelian d, barang b, supplier sup, no_barang n + WHERE m.no_faktur = d.no_faktur + AND d.kode_barang = b.kode_barang + AND b.id_gabungan = n.id_gabungan + AND m.kd_supplier = sup.kd_supplier + AND m.no_faktur='$_REQUEST[nofaktur]' + ORDER BY d.kode_barang"); + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + $jdata = $mysqli->query("SELECT count(*) + FROM m_pembelian m, d_pembelian d, barang b, supplier sup, no_barang n + WHERE m.no_faktur = d.no_faktur + AND d.kode_barang = b.kode_barang + AND b.id_gabungan = n.id_gabungan + AND m.kd_supplier = sup.kd_supplier + AND n.stok > 0 + AND m.no_faktur='$_REQUEST[nofaktur]'"); + $j = $jdata->fetch_array(MYSQL_NUM); + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + $harray[$idx] = array( + 'kode_barang' => $a['kode_barang'], 'kd_supplier' => $a['kd_supplier'], + 'nama_barang' => $a['nama_barang'], 'supplier' => $a['nama_supplier'], + 'tglnota' => $a['tgl_nota'],'tglmasuk' => $a['tgl_masuk'],'tgljthtempo' => $a['tgl_jatuh_tempo'], + 'status' => $a['status'],'keterangan' => $a['keterangan'],'nik' => $a['nik'], + 'jdata' => $j[0] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/umum/ambil_nomor.php b/old-source/umum/ambil_nomor.php new file mode 100644 index 0000000..b534817 --- /dev/null +++ b/old-source/umum/ambil_nomor.php @@ -0,0 +1,34 @@ +query("SELECT DISTINCT nomor FROM d_pembelian WHERE kode_barang='$_REQUEST[idbarang]' ORDER BY nomor"); + $data = $mysqli->query("SELECT n.nomor FROM d_pembelian d, no_barang n, barang b + WHERE d.kode_barang='$_REQUEST[idbarang]' + AND b.id_gabungan = n.id_gabungan + AND (d.kode_barang = b.kode_barang AND d.nomor = n.nomor) + ORDER BY nomor"); + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_NUM)) + { + $harray[$idx] = array('nomor' => $a[0]); + $idx++; + } + } + /* tutup hasil query */ + $data->close(); + /* tutup koneksi */ + $mysqli->close(); + } + /* cetak hasil */ + echo json_encode($harray); +} \ No newline at end of file diff --git a/old-source/umum/ambil_nota.php b/old-source/umum/ambil_nota.php new file mode 100644 index 0000000..3c8e05a --- /dev/null +++ b/old-source/umum/ambil_nota.php @@ -0,0 +1,84 @@ +prepare($query)) +{ + // lakukan bind parameter; + $result->bind_param("s", $no); + // jalankan query; + $result->execute(); + // simpan hasil query; + $result->store_result(); + // simpan jumlah hasil query dalam var jumlah; + $jumlah = $result->num_rows; + // bind hasil query dalam var, kode barang -kb, jumlah -jmlBarang, kd_supplier -kdSupp; + $result->bind_result($kb, $jmlBarang, $kdSupp, $nb); + + // buat objek dari DOM + $dom = new DOMDocument(); + // buat root xml + $response = $dom->createElement("response"); + $dom->appendChild($response); + + // buat node + $barangbarang = $dom->createElement("barangBarang"); + $response->appendChild($barangbarang); + + $kds = ""; + while($result->fetch()) + { + + // buat node + $barang = $dom->createElement("barang"); + $barangbarang->appendChild($barang); + // buat node yang diisi kode barang dari hasil query; + $kodebarang = $dom->createElement("kodeBarang"); + $barang->appendChild($kodebarang); + $kodeText = $dom->createTextNode("$kb"); + $kodebarang->appendChild($kodeText); + + $kds = $kdSupp; + } + + // buat node + $nofaktur = $dom->createElement("noFaktur"); + $response->appendChild($nofaktur); + $fakturText = $dom->createTextNode("$no"); + $nofaktur->appendChild($fakturText); + // buat node untuk menampung jumlah data + $jumlahdata = $dom->createElement("jumlahData"); + $response->appendChild($jumlahdata); + $jumlahText = $dom->createTextNode("$jumlah"); + $jumlahdata->appendChild($jumlahText); + // buat node untuk menampung kode supplier + $kodesupp = $dom->createElement("kodeSupp"); + $response->appendChild($kodesupp); + $kdText = $dom->createTextNode("$kds"); + $kodesupp->appendChild($kdText); + + // simpan xml; + $xmlString = $dom->saveXML(); + // cetak xml; + print ($xmlString); + // tutup hasil query; + $result->close(); +} else +{ + print(""); + print("0"); + print(""); +} +// tutup koneksi; +$mysqli->close(); +?> \ No newline at end of file diff --git a/old-source/umum/cari_nota.php b/old-source/umum/cari_nota.php new file mode 100644 index 0000000..cd4d735 --- /dev/null +++ b/old-source/umum/cari_nota.php @@ -0,0 +1,94 @@ +query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur != "" && $tglawal != "" && $tglakhir != "" && $kdsup == "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur != "" && $tglawal == "" && $tglakhir == "" && $kdsup != "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur != "" && $tglawal == "" && $tglakhir == "" && $kdsup == "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur == "" && $tglawal != "" && $tglakhir != "" && $kdsup != "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur == "" && $tglawal != "" && $tglakhir != "" && $kdsup == "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + else if($nofaktur == "" && $tglawal == "" && $tglakhir == "" && $kdsup != "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND left(no_faktur,4) <> 'RVB-' + ORDER BY tgl_nota"); + + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + + $harray[$idx] = array( + 'no_faktur' => $a['no_faktur'], 'tgl_nota' => substr($a['tgl_nota'],8,2)."-".substr($a['tgl_nota'],5,2)."-".substr($a['tgl_nota'],0,4), 'rp_beli' => $a['rp_beli'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/umum/cari_nota.php~ b/old-source/umum/cari_nota.php~ new file mode 100644 index 0000000..c22673f --- /dev/null +++ b/old-source/umum/cari_nota.php~ @@ -0,0 +1,93 @@ +query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND referensi = '' + ORDER BY tgl_nota"); + else if($nofaktur != "" && $tglawal != "" && $tglakhir != "" && $kdsup == "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND validasi = '1' + AND referensi = '' + ORDER BY tgl_nota"); + else if($nofaktur != "" && $tglawal == "" && $tglakhir == "" && $kdsup != "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND referensi = '' + ORDER BY tgl_nota"); + else if($nofaktur != "" && $tglawal == "" && $tglakhir == "" && $kdsup == "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE no_faktur LIKE '%{$nofaktur}%' + AND validasi = '1' + AND referensi = '' + ORDER BY tgl_nota"); + else if($nofaktur == "" && $tglawal != "" && $tglakhir != "" && $kdsup != "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + AND referensi = '' + ORDER BY tgl_nota"); + else if($nofaktur == "" && $tglawal != "" && $tglakhir != "" && $kdsup == "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE tgl_nota BETWEEN '$tglawal' AND '$tglakhir' + AND validasi = '1' + AND referensi = '' + ORDER BY tgl_nota"); + else if($nofaktur == "" && $tglawal == "" && $tglakhir == "" && $kdsup != "") + $data = $mysqli->query("SELECT no_faktur, tgl_nota, rp_beli + FROM m_pembelian + WHERE kd_supplier LIKE '%{$kdsup}%' + AND validasi = '1' + ORDER BY tgl_nota"); + + /* tampung jumlah data dalam var hasil */ + $hasil = $data->num_rows; + + if($hasil > 0) + { + $idx = 0; + while($a = $data->fetch_array(MYSQLI_ASSOC)) + { + + $harray[$idx] = array( + 'no_faktur' => $a['no_faktur'], 'tgl_nota' => substr($a['tgl_nota'],8,2)."-".substr($a['tgl_nota'],5,2)."-".substr($a['tgl_nota'],0,4), 'rp_beli' => $a['rp_beli'] + ); + $idx++; + } + /* tutup hasil query */ + $data->close(); + } + /* tutup koneksi */ + $mysqli->close(); + /* cetak hasil */ + echo json_encode($harray); +} diff --git a/old-source/update tabel d_retur_beli.txt b/old-source/update tabel d_retur_beli.txt new file mode 100644 index 0000000..74e0b64 --- /dev/null +++ b/old-source/update tabel d_retur_beli.txt @@ -0,0 +1 @@ +ALTER TABLE `d_retur_beli` ADD `id` INT NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`id`); diff --git a/old-source/viewtmpbeli.php b/old-source/viewtmpbeli.php new file mode 100644 index 0000000..fb742cb --- /dev/null +++ b/old-source/viewtmpbeli.php @@ -0,0 +1,93 @@ + +query("SELECT * FROM `tPembelian$pemakai` ORDER BY id"); +if($qry_select->num_rows > 0){ +?> + + + + + + + + + + + + + + + + + fetch_array(MYSQLI_ASSOC)){ + ?> + + + + + + + + + + + + + + + +
NoKode BarangBarcodeNama BarangJumlah BeliSub TotalProfitHarga PokokHarga JualAction
+ Hapus + Edit +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Total Jumlah Beli: *
Total Rp Beli: *
Diskon(%):
Diskon(Rp):
PPN(%):
Total Rp Beli(Nett): *
Keterangan :  (max.100 char) *
+ + \ No newline at end of file