Esempio n. 1
0
<?php 
use yii\helpers\Url;
use kartik\helpers\Html;
use kartik\grid\GridView;
use yii\bootstrap\Modal;
use kartik\nav\NavX;
use crm\mastercrm\models\Customers;
use yii\helpers\ArrayHelper;
$this->params['breadcrumbs'][] = $this->title;
$this->sideCorp = 'Customers';
/* Title Select Company pada header pasa sidemenu/menu samping kiri */
$this->sideMenu = $sideMenu_control;
//'umum_datamaster';   	 /* kd_menu untuk list menu pada sidemenu, get from table of database */
$this->title = Yii::t('app', 'Customers');
/* title pada header page */
$parent = ArrayHelper::map(Customers::find()->where('STATUS<>3 and CUST_KD=CUST_GRP')->all(), 'CUST_KD', 'CUST_NM');
function tombolCustomers()
{
    $title1 = Yii::t('app', 'Customers');
    $options1 = ['id' => 'setting', 'style' => 'text-align:left'];
    $icon1 = '<span class="fa fa-cogs fa-md"></span>';
    $label1 = $icon1 . ' ' . $title1;
    $url1 = Url::toRoute(['/mastercrm/customers-crm/index']);
    //,'kd'=>$kd]);
    $content = Html::a($label1, $url1, $options1);
    return $content;
}
/**
 * New|Change|Reset| Password Login
 * @author ptrnov  <*****@*****.**>
 * @since 1.1
Esempio n. 2
0
 public function getCustTbl()
 {
     return $this->hasOne(Customers::className(), ['CUST_KD' => 'CUST_KD']);
 }
 public function actionJsoncalendar_add()
 {
     if (Yii::$app->request->isAjax) {
         $request = Yii::$app->request;
         $model = new Scheduleheader();
         $profile = Yii::$app->getUserOptcrm->Profile_user();
         $usercreate = $profile->username;
         $end = $request->post('tgl2');
         $start = $request->post('tgl1');
         $scdl_group = $request->post('scdl_group');
         $user_id = $request->post('user_id');
         $note = $request->post('note');
         $model->TGL1 = $start;
         $model->TGL2 = $end;
         $model->CREATE_BY = $usercreate;
         $model->CREATE_AT = date("Y-m-d H:i:s");
         $model->NOTE = $note;
         $model->SCDL_GROUP = $scdl_group;
         $model->USER_ID = $user_id;
         $carisdl = ScheduleDetail::find()->where(['TGL' => $model->TGL1, 'SCDL_GROUP' => $scdl_group])->one();
         // print_r($carisdl);
         // die();
         // if exist data customers
         if ($carisdl) {
             echo 2;
         } else {
             if ($model->save()) {
                 // foreach date :author wawan
                 for ($date = strtotime($start); $date < strtotime($end); $date = strtotime("+1 day", $date)) {
                     $tgl = date("Y-m-d", $date);
                     $Customers = Customers::find()->where(['SCDL_GROUP' => $scdl_group])->asArray()->all();
                     foreach ($Customers as $key => $value) {
                         # code...
                         $connection = Yii::$app->db_esm;
                         $connection->createCommand()->batchInsert('c0002scdl_detail', ['TGL', 'CUST_ID', 'SCDL_GROUP', 'USER_ID'], [[$tgl, $value['CUST_KD'], $scdl_group, $user_id]])->execute();
                     }
                 }
             }
         }
     }
     return true;
 }
Esempio n. 4
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\widgets\Select2;
use yii\helpers\ArrayHelper;
use crm\mastercrm\models\Customers;
/* @var $this yii\web\View */
/* @var $model lukisongroup\esm\models\Kategoricus */
/* @var $form yii\widgets\ActiveForm */
// $drop = Kategoricus::find()->select('CUST_KTG_NM')
// ->where('CUST_KTG_PARENT = 0')
// ->all();
$data_cus = Customers::getNameColumn();
$options = [];
foreach ($data_cus as $key => $value) {
    # code...
    $options[$key] = $value;
}
?>



<div class="kategoricus-form">

    <?php 
$form = ActiveForm::begin(['id' => $model->formName(), 'enableClientValidation' => true]);
?>


      <?php 
 protected function findModelcust($id)
 {
     if (($model = Customers::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 6
0
 public function getNameColumn()
 {
     $data_column = new Customers();
     return $dbSchema = $data_column->getTableSchema()->getColumnNames();
 }
Esempio n. 7
0
 public function searchCustGrp($params)
 {
     $query = Customers::find()->joinWith('custgrp', true, 'JOIN')->where('c0001.STATUS <> 3 AND c0007.STATUS <> 3');
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 20]]);
     $dataProvider->sort->attributes['cus.CUST_KTG_NM'] = ['asc' => ['c0001k.CUST_KTG_NM' => SORT_ASC], 'desc' => ['c0001k.CUST_KTG_NM' => SORT_DESC]];
     $dataProvider->sort->attributes['custype.CUST_KTG_NM'] = ['asc' => ['c0001k.CUST_KTG_NM' => SORT_ASC], 'desc' => ['c0001k.CUST_KTG_NM' => SORT_DESC]];
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // $querya->andFilterWhere([
     //     'CUST_KTG' => $this->CUST_KTG,
     //     'JOIN_DATE' => $this->JOIN_DATE,
     //     'TLP1' => $this->TLP1,
     //     'TLP2' => $this->TLP2,
     //     'FAX' => $this->FAX,
     //     'STT_TOKO' => $this->STT_TOKO,
     //     'CREATED_AT' => $this->CREATED_AT,
     //     'UPDATED_AT' => $this->UPDATED_AT,
     //     'STATUS' => $this->STATUS,
     // ]);
     $query->andFilterWhere(['like', 'CUST_KD', $this->CUST_KD])->andFilterWhere(['like', 'CUST_KD_ALIAS', $this->CUST_KD_ALIAS])->andFilterWhere(['like', 'TLP1', $this->TLP1])->andFilterWhere(['like', 'TLP2', $this->TLP2])->andFilterWhere(['like', 'FAX', $this->FAX])->andFilterWhere(['like', 'c0007.ID', $this->getAttribute('custgrp.ID')])->andFilterWhere(['like', 'CUST_TYPE', $this->getAttribute('custype.CUST_KTG_NM')])->andFilterWhere(['like', 'CUST_NM', $this->CUST_NM])->andFilterWhere(['like', 'CUST_GRP', $this->CUST_GRP])->andFilterWhere(['like', 'MAP_LAT', $this->MAP_LAT])->andFilterWhere(['like', 'MAP_LNG', $this->MAP_LNG])->andFilterWhere(['like', 'PIC', $this->PIC])->andFilterWhere(['like', 'ALAMAT', $this->ALAMAT])->andFilterWhere(['like', 'EMAIL', $this->EMAIL])->andFilterWhere(['like', 'WEBSITE', $this->WEBSITE])->andFilterWhere(['like', 'NOTE', $this->NOTE])->andFilterWhere(['like', 'NPWP', $this->NPWP])->andFilterWhere(['like', 'DATA_ALL', $this->DATA_ALL])->andFilterWhere(['like', 'JOIN_DATE', $this->JOIN_DATE])->andFilterWhere(['like', 'SCDL_GROUP', $this->SCDL_GROUP])->andFilterWhere(['like', 'c0001.STATUS', $this->STATUS]);
     // ->andFilterWhere(['like', 'CORP_ID', $this->CORP_ID])
     // ->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY])
     // ->andFilterWhere(['like', 'UPDATED_BY', $this->UPDATED_BY]);
     return $dataProvider;
 }
Esempio n. 8
0
 /**
  * Creates a new DraftPlan model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new DraftPlan();
     if ($model->load(Yii::$app->request->post())) {
         $hsl = \Yii::$app->request->post();
         $tahun = $hsl['DraftPlan']['YEAR'];
         // $model->save();
         $check_exist = DraftPlan::find()->where(['GEO_ID' => $model->GEO_ID, 'YEAR' => $tahun])->one();
         /*get customers*/
         $get_customers = Customers::find()->where(['GEO' => $model->GEO_ID])->all();
         //     if(count($check_exist) != 0)
         //     {
         //        /*delete plan*/
         //         self::DeletePlan($model->GEO_ID);
         //         /*batch insert*/
         //         foreach ($get_customers as $key => $value) {
         //             # code...
         //               $batch = self::conn_esm()->CreateCommand()->batchInsert('c0002scdl_plan', ['CUST_KD', 'GEO_ID','LAYER_ID','YEAR'], [
         //             [$value->CUST_KD,$value->GEO,$value->LAYER,$tahun],
         //         ])->execute();
         //         }
         //     }else{
         //     /*batch insert*/
         //     foreach ($get_customers as $key => $value) {
         //         # code...
         //           $batch = self::conn_esm()->CreateCommand()->batchInsert('c0002scdl_plan', ['CUST_KD', 'GEO_ID','LAYER_ID','YEAR'], [
         //         [$value->CUST_KD,$value->GEO,$value->LAYER,$tahun],
         //     ])->execute();
         //     }
         // }
         if (count($check_exist) == 0) {
             /*batch insert*/
             foreach ($get_customers as $key => $value) {
                 # code...
                 $batch = self::conn_esm()->CreateCommand()->batchInsert('c0002scdl_plan', ['CUST_KD', 'GEO_ID', 'LAYER_ID', 'YEAR'], [[$value->CUST_KD, $value->GEO, $value->LAYER, $tahun]])->execute();
             }
         }
         return $this->redirect(['index']);
     } else {
         return $this->renderAjax('create', ['model' => $model, 'geo' => $this->get_arygeo()]);
     }
 }
Esempio n. 9
0
 public function getCuslayer()
 {
     return $this->hasOne(Customers::className(), ['LAYER' => 'LAYER_ID']);
 }