/** * Deletes a particular model. * If deletion is successful, the browser will be redirected to the 'admin' page. * @param integer $id the ID of the model to be deleted */ public function actionDelete($id) { $this->loadModel($id)->delete(); // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser if (!isset($_GET['ajax'])) { Yii::app()->user->setFlash('info', MyFormatter::alertError('<strong>Selamat!</strong> Data telah berhasil dihapus.')); $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index')); } }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['GolonganObat'])) { $model->attributes = $_POST['GolonganObat']; if ($model->save()) { Yii::app()->user->setFlash('info', MyFormatter::alertInfo('<strong>Selamat!</strong> Perubahan data telah berhasil disimpan.')); $this->redirect(array('view', 'id' => $model->ID_GOLONGAN_OBAT)); } } $this->render('update', array('model' => $model)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Pasien(); $model->scenario = 'baru'; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Pasien'])) { $model->attributes = $_POST['Pasien']; $model->setAttribute('BIAYA_REGISTRASI', '5000'); $model->setAttribute('TANGGAL_REGISTRASI', date('Y-m-d H:i:s')); if ($model->save()) { Yii::app()->user->setFlash('info', MyFormatter::alertSuccess('<strong>Selamat!</strong> Data telah berhasil disimpan.')); $this->redirect(array('view', 'id' => $model->ID_PASIEN)); } } $this->render('create', array('model' => $model)); }
public function actionSavePembayaran($id) { $order = $this->loadModel($id); $order->scenario = 'save-pembayaran'; $total = $order->getTotal(); $bayar = $_POST['bayar']; $kembali = $bayar - $total; if ($bayar < $total) { $data['result'] = "false"; } else { $order->setAttribute('PEMBAYARAN', $bayar); $order->setAttribute('KEMBALIAN', $kembali); $order->save(); $data['kembalian'] = MyFormatter::formatUang($kembali); $data['result'] = "true"; } echo json_encode($data); }
public function actionIndex() { $id = Yii::app()->user->idUser; $model = User::model()->findByPk($id); // if(isset($_POST['User'])) // { // $model->attributes=$_POST['User']; // // $new_password = $_POST['User']['NEW_PASSWORD']; // // $repeat_password = $_POST['User']['REPEAT_PASSWORD']; // if ($model->validate()) { // // if ($model->cekPassword($new_password,$repeat_password)) { // // $model->setAttribute('PASSWORD',$_POST['User']['NEW_PASSWORD']); // if ($model->save()) { // Yii::app()->user->setFlash('info', MyFormatter::alertSuccess('<strong>Selamat!</strong> Perubahan data telah berhasil disimpan.')); // $this->redirect(array('index')); // } // // else // // Yii::app()->user->setFlash('info', MyFormatter::alertError('<strong>Error!</strong> Password gagal diubah.')); // } // // else { // // Yii::app()->user->setFlash('info', MyFormatter::alertError('<strong>Error!</strong> Password tidak cocok.')); // // } // // } // // if($model->save()) { // // Yii::app()->user->setFlash('info', MyFormatter::alertSuccess('<strong>Selamat!</strong> Perubahan data telah berhasil disimpan.')); // // $this->redirect(array('index','id'=>$model->ID_USER)); // // } // } if (isset($_POST['User'])) { $model->attributes = $_POST['User']; //$model->STATUS = 1; if ($model->save()) { Yii::app()->user->setFlash('info', MyFormatter::alertSuccess('<strong>Selamat!</strong> Perubahan data telah berhasil disimpan.')); $this->redirect(array('index')); } } $this->render('index', array('model' => $model)); }
<tr> <td width="5%"><?php echo $index + 1; ?> </td> <td><?php echo CHtml::link(CHtml::encode($data->NAMA_PASIEN), array('view', 'id' => $data->ID_PASIEN), array('title' => 'Detil')); ?> </td> <td><?php echo CHtml::encode($data->ALAMAT); ?> </td> <td><?php echo CHtml::encode($data->NO_TELP); ?> </td> <td><?php echo CHtml::encode($data->JENIS_KELAMIN == 'L' ? '<i class="fa fa-mars"></i> Pria' : 'Wanita'); ?> </td> <td><?php echo CHtml::encode(MyFormatter::formatTanggalWaktu($data->TANGGAL_REGISTRASI)); ?> </td> <td width="12%"> <?php echo CHtml::link('<i class="fa fa-trash-o"></i> Hapus', array('delete', 'id' => $data->ID_PASIEN), array('class' => 'btn btn-sm red filter-cancel', 'submit' => array('delete', 'id' => $data->ID_PASIEN), 'confirm' => 'Apakah Anda yakin akan menghapus ' . $data->NAMA_PASIEN . '?')); ?> </td> </tr>
?> </td> <td><?php echo CHtml::link(CHtml::encode('Invoice #' . $item->KODE_ORDER . ' - ' . $item->pasien->NAMA_PASIEN), array('/admin/order/view/', 'id' => $item->KODE_ORDER), array('title' => 'Detil Order')); ?> </td> <td><?php echo MyFormatter::formatTanggalWaktu($item->TANGGAL_ORDER); ?> </td> <td><?php echo '<span class="label bg-yellow-gold">' . OrderDetail::getJumlahItem($item->KODE_ORDER) . '</span>'; ?> </td> <td><?php echo MyFormatter::formatUang($item->getTotal()); ?> </td> <!-- <td> <?php echo CHtml::link('<i class="fa fa-search"></i>', array('/admin/order/view/', 'id' => $item->KODE_ORDER), array('class' => 'btn default btn-xs green-stripe')); ?> </td> --> </tr> <?php } ?> </tbody> </table> </div> </div>
</tr> <?php } ?> </tbody> </table> </div> <div class="well"> <table class="table table-condensed table-bordered"> <tbody> <tr><th>Total Item</th><td><span class="label label-danger"><?php echo $totalItem; ?> </span></td></tr> <tr><th>Total</th><td><strong><?php echo MyFormatter::formatUang($model->getTotal()); ?> </strong></td></tr> </tbody></table> </div> </div> </div> <!-- END SAMPLE TABLE PORTLET--> </div> <div class="clearfix"></div> <script src="<?php echo Yii::app()->theme->baseUrl; ?> /assets/custom/jquery.printPage.js" type="text/javascript"></script>
</tr> <tr style="background:none !important"> <td colspan="2"></td> <td colspan="2">Total:</td> <td><strong><?php echo MyFormatter::formatUang($model->getTotal()); ?> </strong></td> </tr> <tr style="background:none !important"> <td colspan="2"></td> <td colspan="2">Pembayaran:</td> <td><strong><?php echo MyFormatter::formatUang($_GET['bayar']); ?> </strong></td> </tr> <tr style="background:none !important"> <td colspan="2"></td> <td colspan="2">Kembali:</td> <td><strong><?php echo MyFormatter::formatUang($_GET['kembali']); ?> </strong></td> </tr> </table> </div> </div> </main> </body> </html>
public static function listAllItem() { $criteria = new CDbCriteria(array('with' => array('kategori' => array('joinType' => 'inner join')), 'condition' => 't.STATUS = :status', 'params' => array(':status' => self::STATUS_AKTIF), 'together' => true)); $model = self::model()->findAll($criteria); $data = CHtml::listData($model, 'ID_ITEM', function ($model) { if ($model->ID_GOLONGAN_OBAT != NULL) { return $model->NAMA_ITEM . ' [' . $model->golongan->NAMA_GOLONGAN . '] - ' . MyFormatter::formatUang($model->HARGA_JUAL); } else { return $model->NAMA_ITEM . ' [' . $model->kategori->KATEGORI . '] - ' . MyFormatter::formatUang($model->HARGA_JUAL); } }); return $data; }
public function actionGagang() { $model = new FormRekap(); if (isset($_POST['FormRekap'])) { $model->attributes = $_POST['FormRekap']; $datestart = date('Y-m-d', strtotime($model->TAHUN . '-' . $model->BULAN . '-01')); $dateend = date('Y-m-t', strtotime($model->TAHUN . '-' . $model->BULAN . '-01')); $criteria = new CDbCriteria(); $criteria->addBetweenCondition('TANGGAL_ORDER', $datestart, $dateend); $order = Order::model()->findAll($criteria); if ($order != null) { $filename = 'REKAP_' . $model->BULAN . '-' . $model->TAHUN; header("Cache-Control: no-cache, no-store, must-revalidate"); header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=" . $filename . ".xls"); $this->renderPartial('_rekap_bulanan', array('order' => $order, 'model' => $model)); exit; } else { Yii::app()->user->setFlash('info', MyFormatter::alertError('Rekap belum tersedia untuk bulan tersebut.')); } } $this->render('gagang/index', array('model' => $model)); }
public function actionIndex() { if (!WebUser::isGuest() && WebUser::isAdmin()) { $this->render('index'); } elseif (!WebUser::isGuest() && WebUser::isKasir()) { //inisialisasi model Order $order = new Order('search'); $order->unsetAttributes(); // clear any default values if (isset($_GET['Order'])) { $order->attributes = $_GET['Order']; } $orderbaru = new Order('baru'); $orderbaru->RESEP = 1; $orderbaru->orderdetail = new OrderDetail('baru'); //inisialisasi model OrderDetail $order_detail = new OrderDetail(); //inisialisasi model Pelanggan $pelanggan = new Pasien('search'); $pelanggan->unsetAttributes(); // clear any default values if (isset($_GET['Pasien'])) { $pelanggan->attributes = $_GET['Pasien']; } $newpl = new Pasien('baru'); // $newpl->ID_LAYANAN = 1; if (isset($_POST['Pasien'])) { $newpl->attributes = $_POST['Pasien']; //$newpl->BIAYA_REGISTRASI = 5000; $newpl->TANGGAL_REGISTRASI = date('Y-m-d H:i:s'); if ($newpl->save()) { Yii::app()->user->setFlash('info', MyFormatter::alertSuccess('<strong>Selamat!</strong> Data telah berhasil disimpan.')); $this->redirect(array('/site')); } } if (isset($_POST['Order'])) { //var_dump($_POST['Order']); //die(); $orderbaru->attributes = $_POST['Order']; $orderbaru->TANGGAL_ORDER = date('Y-m-d H:i:s'); $orderbaru->USER_PEMBUAT = Yii::app()->user->nama; if ($orderbaru->save()) { $subtotal = 0; foreach ($_POST['OrderDetail'] as $detail) { //var_dump($_POST['OrderDetail']); //die(); $od = new OrderDetail('baru'); $od->ID_ITEM = $detail['ID_ITEM']; $od->KODE_ORDER = $orderbaru->KODE_ORDER; //proses harga by resep $od->HARGA = Item::getHargaByResep($detail['ID_ITEM'], $orderbaru->RESEP); $od->JUMLAH = $detail['JUMLAH']; $od->DISKON = $detail['DISKON']; $od->save(); Item::updateStokItem($detail['ID_ITEM'], $detail['JUMLAH']); $subtotal += $od->JUMLAH * $od->HARGA; } Yii::app()->user->setFlash('info', MyFormatter::alertSuccess('<strong>Selamat!</strong> Data telah berhasil disimpan.')); $this->redirect(array('/order/view', 'id' => $orderbaru->KODE_ORDER)); } // if ($orderbaru->validate()) { // $transaction = Yii::app()->db->beginTransaction(); // try { // if (!$orderbaru->save()) // throw new Exception; // $subtotal = 0; // foreach ($_POST['OrderDetail'] as $kd => $detail) { // if (!empty($detail['JUMLAH'])) { // $od = new OrderDetail('baru'); // $od->ID_ITEM = $kd; // $od->KODE_ORDER = $orderbaru->KODE_ORDER; // //proses harga by resep // $od->HARGA = Item::getHargaByResep($kd, $orderbaru->RESEP); // $od->JUMLAH = $detail['JUMLAH']; // //$od->DISKON = $detail['DISKON']; // //$od->DISKON = Barang::getDiskonById($kd); // //var_dump($_POST['OrderDetail']); // //die(); // //update stok barang // Item::updateStokItem($kd, $detail['JUMLAH']); // $subtotal += $od->JUMLAH * $od->HARGA; // if (!$od->save()) // throw new Exception; // } // } // $transaction->commit(); // Yii::app()->user->setFlash('info', MyFormatter::alertSuccess('<strong>Selamat!</strong> Data telah berhasil disimpan.')); // $this->redirect(array('/order/view', 'id' => $orderbaru->KODE_ORDER)); // } catch (Exception $ex) { // $transaction->rollback(); // echo $ex->getMessage(); exit(); // } // } } $criteria = new CDbCriteria(); $criteria->order = 'TANGGAL_REGISTRASI DESC'; $dataProvider = new CActiveDataProvider('Pasien', array('criteria' => $criteria, 'pagination' => false)); $pasien_today = Pasien::listRegisterToday(); $this->render('index3', array('dataProvider' => $dataProvider, 'order' => $order, 'order_detail' => $order_detail, 'pelanggan' => $pelanggan, 'pelanggan_baru' => $newpl, 'orderbaru' => $orderbaru, 'pasien_today' => $pasien_today)); } else { $this->redirect(array('login')); } }
<div class="col-md-4"> <div class="form-group"> <div class="portlet mt-element-ribbon light portlet-fit bordered"> <div class="ribbon ribbon-vertical-right ribbon-shadow ribbon-color-primary uppercase"> <div class="ribbon-sub ribbon-bookmark"></div> <i class="fa fa-star"></i> </div> <div class="portlet-title"> <div class="caption"> <i class=" icon-settings"></i> <span class="caption-subject bold uppercase">Kembalian</span> </div> </div> <div class="portlet-body"> <p id="Order_KEMBALIAN" style="font-size:22px; font-weight:bold; color: #e84d1c;"><?php echo MyFormatter::formatUang($model->KEMBALIAN); ?> </p> </div> </div> </div> </div> </div> </div> <div class="form-actions"> <?php echo CHtml::link('<i class="fa fa-print"></i> Cetak Nota', array('/order/cetak', 'id' => $model->KODE_ORDER), array('class' => 'btn btn-danger pull-right print', 'id' => 'cetaknota')); ?> </div> <?php
<?php if (count($pasien_today) > 0) { foreach ($pasien_today as $value) { ?> <div class="item" style="background-color:#fafafa;"> <div class="item-head"> <div class="item-details"> <div class="label label-sm label-danger"> <i class="fa fa-user"></i> </div> <a href="#" class="item-name primary-link"><?php echo $value->NAMA_PASIEN; ?> </a> <span class="item-label"><?php echo MyFormatter::formatTanggalWaktu2($value->TANGGAL_REGISTRASI); ?> </span> </div> </div> <div class="item-body"></div> </div> <?php } } else { ?> <div class="alert alert-warning"><i>Belum ada pasien yang terdaftar.</i> </div> <?php } ?> </div>
<tr> <td width="5%"><?php echo $index + 1; ?> </td> <td><?php echo CHtml::link(CHtml::encode('Invoice #' . $data->KODE_ORDER . ' - ' . $data->pasien->NAMA_PASIEN), array('view', 'id' => $data->KODE_ORDER), array('title' => 'Detil Order')); ?> </td> <td><?php echo MyFormatter::formatTanggalWaktu($data->TANGGAL_ORDER); ?> </td> <td><?php echo OrderDetail::getJumlahItem($data->KODE_ORDER); ?> </td> <td><?php echo MyFormatter::formatUang($data->getTotal()); ?> </td> <td width="8%"> <?php //echo CHtml::link('<i class="fa fa-pencil"></i> Ubah',array('/order/update/','id'=>$data->KODE_ORDER),array('class'=>'btn btn-sm default btn-editable')); ?> <?php echo CHtml::link('<i class="fa fa-trash-o"></i> Hapus', array('/order/delete/', 'id' => $data->KODE_ORDER), array('class' => 'btn btn-sm red filter-cancel', 'submit' => array('delete', 'id' => $data->KODE_ORDER), 'confirm' => 'Apakah Anda yakin akan menghapus Invoice #' . $data->KODE_ORDER . '?')); ?> </td> </tr>
public function actionStep($id) { DetilItem::model()->updateByPk($id, array('STATUS_PEMBAYARAN' => DetilItem::STATUS_LUNAS, 'TANGGAL_PEMBAYARAN' => date('Y-m-d'))); $item = DetilItem::model()->findByPk($id); Yii::app()->user->setFlash('info', MyFormatter::alertSuccess('<strong>Sukses!</strong> Data telah berhasil disimpan.')); //$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index')); $this->redirect(array('view', 'id' => $item->ID_ITEM)); }
/** * Deletes a particular model. * If deletion is successful, the browser will be redirected to the 'admin' page. * @param integer $id the ID of the model to be deleted */ public function actionDelete($id) { // $this->loadModel($id)->delete(); $order = $this->loadModel($id); $criteria = new CDbCriteria(); $criteria->condition = 'KODE_ORDER = :order'; $criteria->params = array(':order' => $id); $orderdetail = OrderDetail::model()->deleteAll($criteria); //$orderdetail->delete(); $order->delete(); // var_dump(); die(); // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser if (!isset($_GET['ajax'])) { Yii::app()->user->setFlash('info', MyFormatter::alertError('<strong>Selamat!</strong> Data telah berhasil dihapus.')); $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index')); } }
<tr> <td width="5%"><?php echo $index + 1; ?> </td> <td><?php echo CHtml::link(CHtml::encode($data->NAMA), array('view', 'id' => $data->ID_USER), array('title' => 'Detil')); ?> </td> <td><?php echo MyFormatter::formatRoleUser($data->ID_ROLE); ?> </td> <td><?php echo CHtml::encode($data->USERNAME); ?> </td> <td><?php echo $data->TERAKHIR_LOGIN == NULL ? '-' : CHtml::encode(MyFormatter::formatTanggalWaktu($data->TERAKHIR_LOGIN)); ?> </td> <td><?php echo MyFormatter::statusAktif($data->STATUS); ?> </td> <td width="12%"> <?php echo CHtml::link('<i class="fa fa-trash-o"></i> Hapus', array('delete', 'id' => $data->ID_USER), array('class' => 'btn btn-sm red filter-cancel', 'submit' => array('delete', 'id' => $data->ID_USER), 'confirm' => 'Apakah Anda yakin akan menghapus ' . $data->NAMA . '?')); ?> </td> </tr>
<table border="1"> <tr> <th colspan="7">LAPORAN STOK PENJUALAN LENSA BULAN <?php echo MyFormatter::formatBulan($bulan); ?> </th> </tr> <tr> <th>#</th> <th>KODE BARANG</th> <th>NAMA BARANG</th> <th>HARGA</th> <th>STOK</th> <th>STOK TERJUAL</th> <th>STOK AKHIR</th> </tr> <?php $grandtotal = 0; ?> <?php foreach ($item as $i => $data) { ?> <?php $jumlah_stok = Item::getTotalStok($data->ID_ITEM); $jumlah_penjualan = Item::getTotalItemDijual($data->ID_ITEM); $total = $jumlah_stok + $jumlah_penjualan; ?> <tr> <td><?php echo $i + 1; ?>
<tr> <td width="5%"><?php echo $index + 1; ?> </td> <td><?php echo CHtml::link(CHtml::encode($data->LAYANAN), array('view', 'id' => $data->ID_LAYANAN), array('title' => 'Detil')); ?> </td> <td><?php echo MyFormatter::formatUang($data->BIAYA); ?> </td> <td width="12%"> <?php echo CHtml::link('<i class="fa fa-trash-o"></i> Hapus', array('delete', 'id' => $data->ID_LAYANAN), array('class' => 'btn btn-sm red filter-cancel', 'submit' => array('delete', 'id' => $data->ID_LAYANAN), 'confirm' => 'Apakah Anda yakin akan menghapus ' . $data->LAYANAN . '?')); ?> </td> </tr>
public static function getLayananAndBiaya() { $model = self::model()->findAll(); $data = CHtml::listData($model, 'ID_LAYANAN', function ($model) { return $model->LAYANAN . ' - ' . MyFormatter::formatUang($model->BIAYA); }); return $data; }
<!-- BEGIN PAGE HEADER--> <!-- <div class="page-bar"> <ul class="page-breadcrumb"> <li> <a href="index.html">Home</a> <i class="fa fa-circle"></i> </li> <li> <span>Horizontal Menu</span> </li> </ul> <div class="page-toolbar"> <div id="dashboard-report-range" class="pull-right tooltips btn btn-sm"> <i class="icon-calendar"></i> <span class="thin uppercase hidden-xs"><?php echo MyFormatter::formatTanggal(date('Y-m-d')); ?> </span> </div> </div> </div> --> <!-- BEGIN PAGE TITLE--> <h3 class="page-title"> KASIR KLINIK AR RAHMA <small>Selamat datang di Halaman Kasir</small> </h3> <!-- END PAGE TITLE--> <!-- END PAGE HEADER--> <?php echo $content; ?> </div>
foreach ($data->orderdetail as $value) { if ($value->item->ID_KATEGORI == Item::KATEGORI_OBAT) { $total += $value->HARGA * $value->JUMLAH; } } ?> <?php echo MyFormatter::formatUang($total + 33 / 100 + 10 / 100); ?> </br> </td> <td><?php echo MyFormatter::formatUang($data->TOTAL); ?> </td> </tr> <?php $grandtotal += $data->TOTAL; ?> <?php } ?> <tr> <th colspan="4">TOTAL PER BULAN</th> <th><?php echo MyFormatter::formatUang($grandtotal); ?> </th> </tr> </table>
public static function dropTranslationCallable() { self::$translationCallable = null; }
<div class="row margin-bottom-40"> <div class="search-page search-content-3"> <div class="col-lg-12"> <div class="row"> <?php foreach (Item::ListBarangByKategori($i) as $dex => $item) { ?> <div class="col-md-2"> <div class="mt-element-ribbon bg-grey-steel"> <div class="ribbon ribbon-color-danger uppercase"><?php echo $item->NAMA_ITEM; ?> </div> <p class="ribbon-content"> <p><?php echo MyFormatter::formatUang($item->HARGA_JUAL); ?> - <span class="<?php echo $item->getStokItem($item->ID_ITEM) > 0 ? 'label label-sm label-primary' : 'label label-sm label-warning'; ?> "><?php echo $item->getStokItem($item->ID_ITEM) > 0 ? $item->getStokItem($item->ID_ITEM) : 'HABIS'; ?> </span> </p> <div class="row"> <div class="col-md-6"> <div class="form-group"> <?php echo $form->labelEx($orderbaru->orderdetail, 'JUMLAH', array('class' => 'control-label'));
?> </td> <td><?php echo $item->UKURAN; ?> </td> <td><?php echo $item->SATUAN; ?> </td> <td><?php echo MyFormatter::formatUang($item->HARGA_JUAL); ?> </td> <td><?php echo MyFormatter::statusAktif($item->STATUS); ?> </td> <td width="20%"> <?php echo CHtml::link('<i class="fa fa-pencil-square-o"></i> Ubah', array('/admin/item/update/', 'id' => $item->ID_ITEM), array('class' => 'btn dark btn-sm btn-outline sbold uppercase')); ?> <?php echo CHtml::link('<i class="fa fa-trash-o"></i> Hapus', array('/admin/item/hapus/', 'id' => $item->ID_ITEM), array('class' => 'btn red btn-sm btn-outline sbold uppercase', 'submit' => array('hapus', 'id' => $item->ID_ITEM), 'confirm' => 'Apakah Anda yakin akan menghapus ' . $item->NAMA_ITEM . '?')); ?> </td> <!-- <a href="javascript:;" class="btn dark btn-sm btn-outline sbold uppercase"> <i class="fa fa-share"></i> View </a> --> </tr> <?php }