Esempio n. 1
0
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2011 PrestaShop SA
*  @version  Release: $Revision: 6594 $
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/followup.php';
if (isset($_GET['secure_key'])) {
    $secureKey = Configuration::get('PS_FOLLOWUP_SECURE_KEY');
    if (!empty($secureKey) and $secureKey === $_GET['secure_key']) {
        $followup = new Followup();
        $followup->cronTask();
    }
}
 /**
  * Remove the specified caloncustomer from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     CalonCustomer::destroy($id);
     Followup::where('calon_customer_id', '=', $id)->delete();
     return Redirect::route('admin.calon_customer.index')->with('message', 'berhasil hapus calon customer');
 }
 public function ConductApplicatorFollowup($followupId, $data)
 {
     try {
         if (Followup::ConductApplicatorFollowup($followupId, $data)) {
             echo AppUtil::getReturnStatus("Successful", "Conduction Successful");
         } else {
             echo AppUtil::getReturnStatus("Unsuccessful", "Database Error Occurred");
         }
     } catch (Exception $e) {
         echo AppUtil::getReturnStatus("Unsuccessful", $e->getMessage());
     }
 }
Esempio n. 4
0
 public function index()
 {
     $widget = ['baru' => Penjualan::where('status', 1)->whereBetween('tgl_order', [Carbon::now()->startOfMonth(), Carbon::today()])->count(), 'poBaru' => Penjualan::whereBetween('tgl_order', [Carbon::now()->startOfMonth(), Carbon::today()])->count(), 'rls' => Penjualan::where('status', '!=', 1)->whereBetween('tgl_order', [Carbon::now()->startOfMonth(), Carbon::today()])->count(), 'orders' => Order::where('status', 1)->count(), 'agen' => Customer::where('tipe', 2)->orWhere('tipe', 3)->where(DB::raw('YEAR(created_at)'), Carbon::now()->year)->count(), 'mitra' => Customer::where('tipe', 1)->orWhere('tipe', 6)->where(DB::raw('YEAR(created_at)'), Carbon::now()->year)->count(), 'biasa' => Customer::where('tipe', 4)->where(DB::raw('YEAR(created_at)'), Carbon::now()->year)->count(), 'agenLastYear' => Customer::where('tipe', 2)->orWhere('tipe', 3)->where(DB::raw('YEAR(created_at)'), Carbon::now()->year - 1)->count(), 'mitraLastYear' => Customer::where('tipe', 1)->orWhere('tipe', 6)->where(DB::raw('YEAR(created_at)'), Carbon::now()->year - 1)->count(), 'biasaLastYear' => Customer::where('tipe', 4)->where(DB::raw('YEAR(created_at)'), Carbon::now()->year - 1)->count()];
     $box = ['penjualans' => Penjualan::orderBy('tgl_order', 'DESC')->take(7)->get(), 'barangs' => Barang::orderBy('id', 'DESC')->take(4)->get(), 'customers' => Penjualan::with('customer')->orderBy('tgl_order', 'DESC')->take(8)->get(), 'followups' => Followup::orderBy('created_at', 'desc')->take(6)->get(), 'bahan' => DB::table('bahan')->where('stok', 0)->take(5)->get(), 'menipis' => DB::table('bahan')->where('stok', 0)->count()];
     // CHART =========================================================================================
     $laporanTahunan = Penjualan::select(DB::raw('MONTH(tgl_transfer) as month, count(`id`) as count, sum(`nominal`) as nominal'))->where('status', '!=', 1)->where(DB::raw('YEAR(tgl_transfer)'), Carbon::now()->year)->groupBy(DB::raw('YEAR(tgl_transfer)'))->groupBy(DB::raw('MONTH(tgl_transfer)'))->orderBy('tgl_transfer', 'asc')->get();
     $total = ['thisMonth' => Penjualan::where('status', '!=', 1)->where('tgl_transfer', '>=', Carbon::now()->startOfMonth())->sum('nominal'), 'thisMonthLastYear' => Penjualan::where(DB::raw('YEAR(tgl_transfer)'), Carbon::now()->year - 1)->where(DB::raw('MONTH(tgl_transfer)'), Carbon::now()->month)->where('status', '!=', 1)->sum('nominal'), 'lastYear' => Penjualan::where(DB::raw('YEAR(tgl_transfer)'), Carbon::now()->year - 1)->where('status', '!=', 1)->sum('nominal'), 'thisYear' => Penjualan::where(DB::raw('YEAR(tgl_transfer)'), Carbon::now()->year)->where('status', '!=', 1)->sum('nominal')];
     // END OF CHART =========================================================================================
     // dd($total['thisMonth']);
     return View::make('admin', compact('box', 'widget', 'total', 'laporanTahunan'));
 }
Esempio n. 5
0
 public static function saveProject($data, $userId)
 {
     $projnum = AppUtil::generateId();
     $projectBasicDetails = $data->projectDetails;
     $t = time();
     $current = date("Y-m-d", $t);
     $object = array();
     $rollBack = true;
     $db = Database::getInstance();
     $conn = $db->getConnection();
     $conn->beginTransaction();
     $stmt = $conn->prepare("SELECT `ProjectName` FROM `project_master` WHERE `ProjectName`= :projectName");
     $stmt->bindParam(':projectName', $projectBasicDetails->ProjectName, PDO::PARAM_STR);
     $stmt->execute();
     $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
     if (count($result) > 0) {
         return 2;
     }
     $stmt = $conn->prepare("INSERT INTO project_master (ProjectId, ProjectName, ProjectManagerId, ProjectSource, IsSiteTrackingProject, ProjectStatus, CustomerId, IsClosedProject, isDeleted, CreationDate, CreatedBy, LastModificationDate, LastModifiedBy)\n\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)");
     if ($stmt->execute([$projnum, $projectBasicDetails->ProjectName, $projectBasicDetails->ProjectManagerId, $projectBasicDetails->ProjectSource, '0', 'Initiated', $projectBasicDetails->CustomerId, '0', '0', $current, $userId, $current, $userId]) === TRUE) {
         $stmt2 = $conn->prepare("INSERT INTO project_address_details (ProjectId, Address, City, State, Country, Pincode) VALUES (?,?,?,?,?,?)");
         if ($stmt2->execute([$projnum, $projectBasicDetails->Address, $projectBasicDetails->City, $projectBasicDetails->State, $projectBasicDetails->Country, $projectBasicDetails->Pincode]) === TRUE) {
             $stmt3 = $conn->prepare("INSERT INTO project_point_of_contact_details (ProjectId, PointContactName, MobileNo, LandlineNo, EmailId) VALUES (?,?,?,?,?)");
             if ($stmt3->execute([$projnum, $projectBasicDetails->PointContactName, $projectBasicDetails->MobileNo, $projectBasicDetails->LandlineNo, $projectBasicDetails->EmailId]) === TRUE) {
                 $break = false;
                 foreach ($data->companiesInvolved as $company) {
                     $stmt4 = $conn->prepare("INSERT INTO companies_involved_in_project (ProjectID, CompanyID) VALUES (?,?)");
                     if (!$stmt4->execute([$projnum, $company->companyId])) {
                         throw new Exception($stmt4->errorInfo);
                         $break = true;
                         break;
                     }
                 }
                 if (!$break) {
                     $conn->commit();
                     $rollBack = false;
                     if (isset($data->followupData)) {
                         if (Followup::CreateSiteTrackingFollowup($projnum, $data->followupData, $userId)) {
                             //  echo AppUtil::getReturnStatus("Successful", "Conduction Successful");
                         } else {
                             //  echo AppUtil::getReturnStatus("Unsuccessful", "Database Error Occurred");
                         }
                     }
                 }
             } else {
                 throw new Exception($stmt3->errorInfo);
             }
         } else {
             throw new Exception($stmt2->errorInfo);
         }
     } else {
         throw new Exception($stmt->errorInfo);
     }
     if ($rollBack) {
         $conn->rollBack();
         return 0;
     }
     $conn = null;
     return 1;
 }
 /**
  * Remove the specified followup from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Followup::destroy($id);
     return Redirect::route('admin.followup.index');
 }