dreamxyz

Experience

6,060

0 Best Reply Awards

  • Member Since 8 Months Ago
  • 1 Lesson Completed
  • 0 Favorites

12th February, 2018

dreamxyz started a new conversation How To Split Data Into A Table Column Side By Side? • 5 days ago

This is my view blade code

<table>
<thead>
<th>name</th>
<th>qty</th>
</thead>
<tbody>
  @foreach ($users as $user)
      @foreach ($user->displayDetails($user->id) as $d)
       <tr>
          <td>{{$d->id}}</td>
          <td>{{$d->qty}}</td>                             
       </tr>
     @endforeach
    @endforeach
</tbody>
</table>

What i am expected is to show

id | qty    id | qty
1     20       2    10
3    5          4   50

Or

id | qty    id | qty
1     20       3    5
2    10       4    50

Any idea how to make it in this way?

6th February, 2018

dreamxyz started a new conversation How To Use LengthAwarePaginator With Checkboxes By Retaining Its Value? • 1 week ago

I am using LengthAwarePaginator to display my item.

In my blade, every of my item attached with one checkbox. I am writing JQuery to select all of the checkbox, but it only allow select the page 1 and state lost when paginate to page 2.

I have a button to select all of the checkboxes included next pages.

What solution can i use for persist the value of checkbox while paginate to other pages?

30th January, 2018

dreamxyz left a reply on How To Do Conversion Between Kg And G When Order Item? • 2 weeks ago

@Snapey i have no idea, i have been told the rate must be in whole number. In this case, i have nothing to indicate when to multiply and divide.

There's some case maybe

when 1 BOX to 20 BOTTLE : rate should be 0.05 = 20 ( the rate should be stored 0.05 but they want to store 20 for rate)

When 20 BOTTLE to 1 BOX : rate 20 (this should be ok)

I have no idea why to do this.

dreamxyz left a reply on How To Do Conversion Between Kg And G When Order Item? • 2 weeks ago

@Snapey I only have ordered_uom, received_uom and conversion_rate for the item. There's nothing can tell me to divide or multiply right? How can i actually achieve this?

dreamxyz left a reply on How To Do Conversion Between Kg And G When Order Item? • 2 weeks ago

@Borisu But, I have 2 column on table to display ordered UOM and received UOM.

How do i display 1KG on the ordered uom column and 1000g instead of 0.001 on received uom column?

I always use ordered_uom/ rate, therefore there will be wrong uom value show for 1 side

for example,

1 kg        0.001g // should be 1000g
1000g   1kg

I been told not to use decimal for rate, e.g:

 ordered_uom / received_uom = rate

Is there anyway to achieve this?

dreamxyz started a new conversation How To Do Conversion Between Kg And G When Order Item? • 2 weeks ago

Let's say user buy item A and item B,

item A ordered in KG, while item B ordered in G.

On my table, i stored ordered_uom, received_uom and conversion_rate for the item.

Item A - ordered_uom : KG, received_uom: G, conversion rate: 1000
item B - ordered_uom : G, received_uom: KG, conversion rate: 1000

In my blade i show the 2 item by looping, and the condition is there

if(rate)
ordered_uom/rate
else
ordered_uom/1

Because of rate must be a whole number, there is a problem conversion from KG to G.

How can i show the multiply for conversion to G from KG? How should i write the condition therefore it works for conversion between KG and G?

Is the logic right?

25th January, 2018

dreamxyz left a reply on How To Ensure Email Deliverability While Sending Mail? • 3 weeks ago

@tisuchi not working for this, it will still success even email not existed.

dreamxyz started a new conversation How To Ensure Email Deliverability While Sending Mail? • 3 weeks ago

I am using the method below to send the mail

Mail::send()

After sent, how can i know whether the mail is successfully sent or rejected? Is that possible to do that?

12th January, 2018

dreamxyz started a new conversation Issue Occurred When Trying To Loop Import Data From Excel. • 1 month ago

I load the data into a collection.

$reader = \Excel::load(Input::file('import_file'))->get();

During looping, i had some condition for checking for the data

foreach ($reader as $r){

$arr = array();

dd($r->id); // this show me undefined property $id

arr['id'] = $r->id;  // this no have problem
}

Why? What's wrong with this?

8th January, 2018

dreamxyz left a reply on How To Read Value In Integer Format For Excel Column Instead Of Getting Decimal Places? • 1 month ago

@bobbybouwmann Which mean that, in excel the value is integer (e.g. 5), when i get the $reader value then it shows me 5.0 .

7th January, 2018

dreamxyz started a new conversation How To Read Value In Integer Format For Excel Column Instead Of Getting Decimal Places? • 1 month ago

I am using this code to get the data from my excel file. But, the output for integer column keep getting decimal places. I need it to be integer for array_diff().

            $reader = \Excel::load(Input::file('import_file'))->toArray();

5th January, 2018

dreamxyz started a new conversation How Can I Check The Data In Array Which Is Existed And Removed It From Array Then Store To Database? • 1 month ago

I have a table as shown below

id_user | id_vendor
1       | 1
2       | 2
1       | 3

User are allow to select multiple user_id and link to multiple id_vendor.

One user may link to multiple vendor and one vendor will link to multiple different user.

User allowed to select multiple id_user and id_vendor and store to database.

In controller, i will get the data in 2 different array, $id_user and $id_vendor.

Before storing, if records already exist for id_user and id_vendor then will not save into database. How can i do this to prevent duplicated data inserted?

3rd January, 2018

dreamxyz started a new conversation How To Set Column Visibility In Maatwebsite Excel During Export? • 1 month ago

I want to prevent unique id being exposed to user, thus need to make certain column hidden during export. How can i do that?

I tried, but not working.

->getActiveSheet()->getColumnDimension('A')->setVisible(false);

//[ERROR] Laravel Worksheet method [getActiveSheet] does not exist.

dreamxyz left a reply on Can I Compare Excel And Database Data While Importing And Highlight The Different? • 1 month ago

@Robstar i knew diff() function. As i know, it only returns the different one. I can ignore the existing record and just show the new record before importing data, at the same time i also need to keep track the changes made on the existing record.

dreamxyz left a reply on Can I Compare Excel And Database Data While Importing And Highlight The Different? • 1 month ago

@bobbybouwmann Yeah, both are return as collection.

E.g.

//database data
array:220 [▼
  0 => array:3 [▼
    "item_code" => "AYT001"
    "product_name" => "abc"
    "description" => "efg"
  ]

//excel data
array:220 [▼
  0 => array:3 [▼
    "item_code" => "AYT001"
    "product_name" => "qwe"
    "description" => "efg"
  ]
array:220 [▼
  1 => array:3 [▼
    "item_code" => "AYT002"
    "product_name" => "water"
    "description" => "water"
  ]

In my view, i want all data get from excel to be displayed in table. For product_name"qwe" will be highlighted because different from database data. And also the code AYT002 is a new record and entired row will be highlighted.

If i am using diff(), will i get the expected result?

dreamxyz left a reply on Can I Compare Excel And Database Data While Importing And Highlight The Different? • 1 month ago

Store the result from database and excel data into separated arrays and then use nested loop to compare between them?

dreamxyz left a reply on Can I Compare Excel And Database Data While Importing And Highlight The Different? • 1 month ago

@bobbybouwmann i able to fetch both result, but not sure how to compare the result between them.

2nd January, 2018

dreamxyz started a new conversation Can I Compare Excel And Database Data While Importing And Highlight The Different? • 1 month ago

I am using maatwebsite to import excel data to database. Before that, i want to show the changes in a simple table by comparing both excel and database data and highlight the different between them. Is that possible to do that?

29th December, 2017

dreamxyz started a new conversation How To Print Page Number As Footer For Every Printed Page? • 1 month ago

I have tried this in Google Chrome but not working.

#content {
    display: table;
 }
#pageFooter {
    display: table-footer-group;
 }

#pageFooter:after {
    counter-increment: page;
    content: counter(page);
 }

//html code

 <div id="content">
     <div id="pageFooter">Page </div>
     multi-page content here...
 </div>

Is there any solution to do this?

28th December, 2017

dreamxyz left a reply on How To Loop Data Into Table When The Data Column Is Less Than Column Header? • 1 month ago

This is the query result

item_name       price_n_date
Item A              1.00 / 2013-07-13 14:35,2.00 / 2013-07-14 14:35, 1.00 / 2013-07-15 14:35

dreamxyz left a reply on How To Loop Data Into Table When The Data Column Is Less Than Column Header? • 1 month ago

@Snapey yes, just facing problem while looping it.

dreamxyz left a reply on How To Loop Data Into Table When The Data Column Is Less Than Column Header? • 1 month ago

@xmarks yes, i tried if else statement earlier, but it will double the looping. if the $price_n_date consist of 2 value then it will became 4.

dreamxyz left a reply on How To Loop Data Into Table When The Data Column Is Less Than Column Header? • 1 month ago

@Snapey The data is show vertically for query output result. i concat it to show it in horizontally in the view.

dreamxyz left a reply on How To Loop Data Into Table When The Data Column Is Less Than Column Header? • 1 month ago

@RamjithAp I think you don't get what i mean.

  1. I have a table with 31 fixed column header which indicate as day.
  2. I used group concat and concat the price and date for each item.
  3. I want it to be displayed in html table by converted the date to day for the item and then insert price to the particular column. E.g. if day 1 match with the date after converted to day then the day 1 column will be inserted price else will be dashed.

If i have an item with only 3 price with date

Item A -    1.00 / 2013-07-13 14:35,2.00 / 2013-07-14 14:35, 1.00 / 2013-07-15 14:35

I will need to insert the price into column 13,14, and 15 with value 1.00,2.00, and 1.00. And left the other column with dash '-'.

dreamxyz left a reply on How To Loop Data Into Table When The Data Column Is Less Than Column Header? • 1 month ago

@RamjithAp No, i no need all column, i just need item name, price and it's date. I will do checking with the column header number, it represents the days of date.

dreamxyz started a new conversation How To Loop Data Into Table When The Data Column Is Less Than Column Header? • 1 month ago

I have a table as shown below

<html>
<head>
<style>
table {
    font-family: arial, sans-serif;
    border-collapse: collapse;
    width: 100%;
}

td, th {
    border: 1px solid #dddddd;
    text-align: left;
    padding: 8px;
}

tr:nth-child(even) {
    background-color: #dddddd;
}
</style>
</head>
<body>

<table>
<thead style="font-size: 12px">
    <tr>
        <?php

            for($k=1;$k<=31;$k++){
                echo '<th style="width: 2.5%;text-align: center;align-content: center">'.$k.'</th>';
            }
        ?>
    </tr>
    </thead>
    <tbody>
   @foreach($results as $key => $r)
        <tr>
        
       <?php
          $price_n_date = explode(',',  $r->price_date);      
           foreach ($price_n_date as $value) {
             list($price,$date) = explode ('/',$value)

     echo '<td>'.$price.'</td>';
        // How can i compare with day and display value of the day to the column?
         }
  ?>
        </tr>
        @endforeach
    </tbody>
</table>

</body>
</html>

The $results return item with it's price and date. Each item may be returned only few columns of value among 31 columns.

How can i loop 31 times even only 3 value and convert the date to days match with column header?

27th December, 2017

dreamxyz started a new conversation How To Loop Value Based On Date Into Day Column In Table? • 1 month ago

The price date is get from

 GROUP_CONCAT(CONCAT(price, ' / ', date)) AS price_date

$r->price_date // data output:  1.00 / 2013-07-13 14:35,2.00 / 2013-07-13 14:35

@foreach($results as $r)
   <?php
       $price_n_date = explode(',',  $r->price_date);      
         foreach ($price_n_date as $value) {
           list($price,$date) = explode ('/',$value)
        // How can i compare with day and display value of the day to the column?
         }
  ?>
@endforeach

I have a table which generate 31 column of days 1st to 31st in table header. In tbody, i will loop an item with it's price and date which will be displayed in the day column from 1st to 31st, if the day of date and the day column matched then only show value else will show a dash.

It is something like attendance list, but i am going to show the price changes of the item on the month based on day.

I am trying to display all the value with following day stored in database.

dreamxyz left a reply on Is That Possible To Use Carbon Parse Only Month And Year To String Without Day? • 1 month ago

@bobbybouwmann By using createFromDate(), it will show me the result

2017-12-01 14:21:31

I am expected only show

December 2017

dreamxyz started a new conversation Is That Possible To Use Carbon Parse Only Month And Year To String Without Day? • 1 month ago

I have a value

12/2017

I want convert it to December 2017. Is that possible to do so using Carbon?

25th December, 2017

dreamxyz started a new conversation Seeking For Suggestion On Purchase Price History Report Layout In Grid View. • 1 month ago

I have 2 type of view for this report which is list and grid view. Currently i will let user to select the view and filters belong to the view. The only different for the filter for view is the 'date filtering'. List view filtered based on date range while grid view filtered based on month/year. In list view, result will be displayed in more details, while grid view will only show the price changes based on date. I will display 1st to 31th based on month selected by the user on column grid view and display relevant item purchased price changes on the column.

Is my logic correct or any better suggestion on doing this? Thanks.

19th December, 2017

dreamxyz started a new conversation How To Exclude A Specific Column From Query When Using Query Builder? • 1 month ago

I am using query builder to get my data from database.

$result = DB::table('test')->..........

Instead of explicitly select all the column, is there a better way to select every column except for certain column?

12th December, 2017

dreamxyz left a reply on How Can I Manage To Get All Of The Foreign Key When Grouping Based On Code And Show In Data Table? • 2 months ago

@Snapey yes, i am storing id_supplier in product table. I able to display it in table by just one row for each item code with it's supplier. I also need the name of supplier as well, but i face problem on separating id and name.

//query
select code, group_concat(s.supplier_id,s.supplier_name) AS supplier_id_name
from catalog c
left join product p on p.product_id= c.product_id
left join supplier s on s.supplier_id = p.product_id
group by code;


//query will show following output

id supplier - 1,  name - abc
id supplier - 2, name - def

Code        | Supplier
A001        | 1abc,2def  // id and name of supplier

What i am expected

Code        | Supplier
A001        | checkboxes value = 1 and then display supplier name beside....... and                     continue in the same row if  more supplier

dreamxyz left a reply on How Can I Manage To Get All Of The Foreign Key When Grouping Based On Code And Show In Data Table? • 2 months ago

@bobbybouwmann I need to show one row only for each item code. I tried use *** group_concat*** to make it, and the sql output display as shown below

    A001 | 1,2

I want to loop it and display in datatable

@foreach($result as $r)

// how can i loop the id_supplier and assign to each checkboxes?

@end for loop

11th December, 2017

dreamxyz started a new conversation How Can I Manage To Get All Of The Foreign Key When Grouping Based On Code And Show In Data Table? • 2 months ago

I have 2 table as shown below

Product table
|---------------------|------------------|------------------|
|    id_product      |  id_supplier   |   name            |   
|---------------------|------------------|------------------|
|          1                 |         1             |      abc              |     
|---------------------|------------------|------------------|
|          2                 |         2                |       acc              |                           
|---------------------|------------------|------------------|

Catalog table
|---------------------|------------------|------------------|
|    id_product      |  id_supplier   |   item code   |   
|---------------------|------------------|------------------|
|          1                 |         1             |      A001            |     
|---------------------|------------------|------------------|
|          2                 |         2                |       A001          |                           
|---------------------|------------------|------------------|

There are 2 supplier which supply the same item, i will assigned them to the same item code. I will write a query to group by item code where i can't get 2 of the id supplier. I want to display the product information and its supplier in dropdown list in datatable. How can i achieve that?

7th December, 2017

dreamxyz started a new conversation What Is Correct Placement Of Js And Css In Blade View? • 2 months ago

In view, where should i place the js and css resources?

@section(content_header)
or
@section(content)
or
// After section content?

How can i determine which js or css should be placed first and after the other?

6th December, 2017

dreamxyz started a new conversation Display Item In Grid View • 2 months ago

I am currently try to display item for user add to cart in grid view. I tried LengthAwarePaginator but when paginate to next pages, very slow and not proper alignment etc. Is there any other method can be used to display item in grid view?

27th November, 2017

26th November, 2017

dreamxyz started a new conversation Trying To Get Non-properties Error While Using Count When Database Return No Result • 2 months ago

In my controller

 $results = DB::select($query);

In my blade view

@if(count($results) > 0)
...
@else
No result found.
@endif

I am getting error trying to get non-property object while the query is null. What's the problem?

24th November, 2017

dreamxyz started a new conversation How Can I Manually Increment By Any Number For The Letter Of Alphabet? • 2 months ago

$row = 'A';


if($row_a== true){
              $row++;
        }
        if($row_b == true){
           $row++;
        }
        if($row_c == true){

            $row++;
        }
        if($row_d == true){
           $row++;
        }
        if($row_e == true){
            $row++;
        }

I have a condition to hide or show the column, everytime user select then the column will increased by 1 same to alphabet.

Now, user select the value $row_a, then the row will became 'B'. How can i manually let 'B' became 'D' without affect the $row?

dreamxyz started a new conversation How To Set The Grand Total With Col Span Using Maatwebsite/Laravel-Excel? • 2 months ago

I pull the data from database and export to xls file, i showed header and content, but how can i include the grand total with colspan based on column to the excel?

// header, content

$someArray = [];$total_qr = "";  $total = "";
            foreach ($results as $key => $r) {
                $row = array();
                $row['No.'] = $key+1;
                foreach($groupOption as $go) {
                    if ($go == 1) {
                        $row['Name'] = $r->name;
                    }
                    if ($go == 2) {
                        $row['Address'] = $r->address;
                    }
                    }

            
                //$row['Total'] =  $r->total;
                   $paArray[] = $row;
            }
   
            
            $today = Carbon::now()->toDateString();
        $myFile=  Excel::create('Report_'. $today, function($excel) use ($someArray )
            {
                $excel->setTitle('Report');
                $excel->sheet('Report', function($sheet) use ($someArray ) {
                    $sheet->fromArray($someArray , null, 'A1', true);
                });
            });
    }

Currently, i sho hw my header and content in excel. Butow can i set e.g. grand total at the end of the content with colspan?? Thanks.

21st November, 2017

dreamxyz left a reply on How To Show Count Of Array In Blade And If Count Equal To 1 Then Show The Value? • 2 months ago

@saurabhd For example, i have a dropdown list in my blade, i will select multiple item from the dropdown list. After that, i will pass to my controller and send to another view for printing purpose.

$id_branch = Input::get('id_branch')
$noOfBranch =  count($id_branch);  //to show number of branch selected

i will pass the $noOfBranch to my printing view, to show how many branch being selected at top corner. It works fine for me when branch selected more than one, how if the user only select 1 branch and i want to display the branch name in my printing view?

//when user select more than 1
Branch : 2 selected

//when user select only one
Branch : ABC Company

dreamxyz started a new conversation How To Show Count Of Array In Blade And If Count Equal To 1 Then Show The Value? • 2 months ago

$id_branch is used to store dropdown list value.

$id_branch = Input::get('id_branch')
$noBranch =  count($id_branch);

I will pass the count to my blade after that. But how can i show only branch name if only 1 item is selected instead of count as 1?

20th November, 2017

dreamxyz started a new conversation How To Pass Parameter From Controller To Jasper Report? • 2 months ago

This is my route

Route::get('/reports', function () {

    $output = public_path() . '/examples/'.time().'_hello_world';
    $report = new JasperPHP;
    $report->process(
        public_path() . '/examples/hello_world.jrxml',
        $output,
        array('pdf', 'rtf', 'xml'),
        array(),
        array()  
        )->execute();
});

How can i pass my parameter to query in jrxml file??

dreamxyz left a reply on Is There Any Report Generator For Laravel? • 2 months ago

How do i actually pass the parameter from controller to jasper report?

19th November, 2017

dreamxyz left a reply on Is There Any Report Generator For Laravel? • 2 months ago

@tisuchi Is that mean i build my report in jasper studio and integrate report to my apps only?

dreamxyz left a reply on Is There Any Report Generator For Laravel? • 2 months ago

@tisuchi The first link seem like fixed template? If using JasperStudio how do i connect the database from phpmyadmin?

dreamxyz left a reply on Is There Any Report Generator For Laravel? • 2 months ago

@robrogers3 This is the sample output i want - http://www.basoftware.com.my/wp-content/uploads/2016/01/yearly-purchase-1.png

//css
 @page {

                margin-bottom: 40px;
                counter-increment: page;
                content: "Page " counter(page) " of " counter(pages);

        @bottom-right  {
            border-top: 1px solid #000000;
            padding-right: 20px;
            font-size: 12px !important;

        }
        @bottom-left  {
            content: "Footer content goes here.";
            border-top: 1px solid #000000;
        }

        }

        div#printhead {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 2em;
            text-align: center;
            padding-bottom: 1em;
            border-bottom: 1px solid;
            margin-bottom: 10px;
        }

        div#printhead {
            display: block;
            clear: both;
            text-align: center;
        }

        div#docbody {counter-reset: page;
            margin-top: 3em;
            overflow: visible !important;
            overflow-wrap: break-word;
            page-break-after: auto;
            height: 50px;
        }

        body {

            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }

        .footer {
            width: 100%;
            display: flex;
            margin-top: auto;
            justify-content: space-between;
            bottom: 0px;
            font-size: 12px;
            position: fixed;
        }

        .left {
            width: 15%;
        }

        .footer::after {
            counter-increment: page;
            content: counter(page);
            font-size: 12px;

        }



//sample html
<body>
<div>
    <span>Information:</span><br><span>aaaaa</span>
    <div id="printhead">
        <p>
            This is the print page header
        </p>
    </div>
    </div>
    <div id="docbody" >
       <p>aaaaaaaaaa</p>
        <p>aaaaaaaaaa</p>
        <p>aaaaaaaaaa</p>
        <p>aaaaaaaaaa</p>
        <p>aaaaaaaaaa</p>
        <p>aaaaaaaaaa</p>
        <p>aaaaaaaaaa</p>
.....
    </div>

    <div class="footer">
        <p class="left">this is a footer   Page </p>
        <p class="right"></p>
    </div>
</body>

Header and footer mean every printed page will show header like company name and footer like page 1 of 2 etc.

dreamxyz started a new conversation Is There Any Report Generator For Laravel? • 2 months ago

I want to generate a report, i am facing problem if i do it with html where there are header and footer also number of page. Is there any package can generate a custom report?

17th November, 2017

dreamxyz started a new conversation How To Design A Item Sale Analysis Report? • 3 months ago

I want to design a item sale analysis report in printable version, is there any good design template for this kind of report?

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.