Skip to content

Commit

Permalink
Merge pull request smarty-php#18 from think-ahead/ticket-#5098-make-i…
Browse files Browse the repository at this point in the history
…t-easier-to-find-reservations-which-have-undecided-push-type

Ticket #5098 make it easier to find reservations which have undecided push type
  • Loading branch information
think-katou authored Nov 6, 2020
2 parents e74303b + d460f01 commit 3cb9168
Showing 1 changed file with 52 additions and 29 deletions.
81 changes: 52 additions & 29 deletions app/controllers/servers_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -938,15 +938,16 @@ class ServersController extends WebServicesController
'wsGetReservation' => array(
'doc' => 'GetReservation',
'input' => array(
'sessionid' => 'xsd:string',
'storecode' => 'xsd:int',
'origination' => 'xsd:int',
'datefr' => 'xsd:string',
'dateto' => 'xsd:string',
'pageno' => 'xsd:int',
'ascsort' => 'xsd:int',
'colsort' => 'xsd:int',
'syscode' => 'xsd:int'
'sessionid' => 'xsd:string',
'storecode' => 'xsd:int',
'origination' => 'xsd:int',
'datefr' => 'xsd:string',
'dateto' => 'xsd:string',
'pageno' => 'xsd:int',
'ascsort' => 'xsd:int',
'colsort' => 'xsd:int',
'syscode' => 'xsd:int',
'kanzashi_undecided_only' => 'xsd:boolean',
),
'output' => array('return' => 'tns:return_storeReservationListing')
),
Expand Down Expand Up @@ -2308,19 +2309,20 @@ class ServersController extends WebServicesController
)),

'storeReservationListing' => array('struct' => array(
'transdate' => 'xsd:string',
'starttime' => 'xsd:string',
'cname' => 'xsd:string',
'staffname' => 'xsd:string',
'reservationdt' => 'xsd:string',
'reservationtm' => 'xsd:string',
'transstat' => 'xsd:string',
'alreadyread' => 'xsd:int',
'keyno' => 'xsd:int',
'transcode' => 'xsd:string',
'route' => 'xsd:string',
'syscode' => 'xsd:string',
'recctr' => 'xsd:string'
'transdate' => 'xsd:string',
'starttime' => 'xsd:string',
'cname' => 'xsd:string',
'staffname' => 'xsd:string',
'reservationdt' => 'xsd:string',
'reservationtm' => 'xsd:string',
'transstat' => 'xsd:string',
'alreadyread' => 'xsd:int',
'push_to_kanzashi' => 'xsd:string',
'keyno' => 'xsd:int',
'transcode' => 'xsd:string',
'route' => 'xsd:string',
'syscode' => 'xsd:string',
'recctr' => 'xsd:string'
)),
'_storeReservationListing' => array(
'array' => 'storeReservationListing'
Expand All @@ -2331,8 +2333,9 @@ class ServersController extends WebServicesController


'storeReservationCounter' => array('struct' => array(
'wrkr' => 'xsd:int',
'bmr' => 'xsd:int'
'wrkr' => 'xsd:int',
'bmr' => 'xsd:int',
'kanzashi_undecided' => 'xsd:int'
)),
'_storeReservationCounter' => array(
'array' => 'storeReservationCounter'
Expand Down Expand Up @@ -2939,16 +2942,21 @@ function wsGetReservationCounter($sessionid, $strcode, $datefr, $dateto)

$storecodecond = $strcode > 0 ? " and str_hdr.storecode = {$strcode} " : '';

$sql = "select bmr, wrkr
$sql = "select
bmr,
wrkr,
kanzashi_undecided
from (
select
count(if(origination in (7,8,9,11,12), transcode, null)) as bmr,
count(if(origination in (1,2,13), transcode, null)) as wrkr
count(if(origination in (1,2,13), transcode, null)) as wrkr,
sum(push_to_kanzashi = 'UNDECIDED') as kanzashi_undecided
from (
select
str_hdr.transcode,
str_hdr.origination,
ifnull(str_trans2_hdr.read, 0) as yread
ifnull(str_trans2_hdr.read, 0) as yread,
str_hdr.push_to_kanzashi
from store_transaction as str_hdr
join store_transaction_details as str_dtl on str_hdr.transcode = str_dtl.transcode and str_hdr.keyno = str_dtl.keyno
left join store_services as str_svr on str_dtl.gcode = str_svr.gcode
Expand Down Expand Up @@ -2987,9 +2995,10 @@ function wsGetReservationCounter($sessionid, $strcode, $datefr, $dateto)
* @param mixed $ascsort
* @param mixed $colsort
* @param mixed $syscode
* @param boolean $kanzashi_undecided_only
* @return array[]
*/
function wsGetReservation($sessionid, $strcode, $origination, $datefr, $dateto, $pageno, $ascsort, $colsort, $syscode)
function wsGetReservation($sessionid, $strcode, $origination, $datefr, $dateto, $pageno, $ascsort, $colsort, $syscode, $kanzashi_undecided_only)
{

//===================================================================================
Expand Down Expand Up @@ -3055,6 +3064,9 @@ function wsGetReservation($sessionid, $strcode, $origination, $datefr, $dateto,
$wherecond .= " and svr.syscode in ({$syscode})";
}

if ($kanzashi_undecided_only) {
$wherecond .= " and str_hdr.push_to_kanzashi = 'UNDECIDED'";
}

switch ($colsort) {
case 0:
Expand All @@ -3078,13 +3090,19 @@ function wsGetReservation($sessionid, $strcode, $origination, $datefr, $dateto,
case 6:
$orderby = ' route ';
break;
case 7:
$orderby = ' push_to_kanzashi ';
break;
}

if (!empty($orderby)) {
$orderby .= $ascsort == 0 ? ' desc ' : ' asc ';
}





$curRec = $pageno * 50;

$sql = "select *
Expand All @@ -3110,7 +3128,11 @@ function wsGetReservation($sessionid, $strcode, $origination, $datefr, $dateto,
end as route,
ifnull(str_trans2_hdr.read, 0) as alreadyread,
group_concat(distinct svr.syscode) as syscode, str_hdr.origination,
STR_TO_DATE(concat(str_hdr.transdate, ' ', ifnull(str_hdr.YOYAKUTIME,'')),'%Y-%m-%d %H:%i:%s') as reservation_datetime
STR_TO_DATE(concat(str_hdr.transdate, ' ', ifnull(str_hdr.YOYAKUTIME,'')),'%Y-%m-%d %H:%i:%s') as reservation_datetime,
case when str_hdr.push_to_kanzashi = 'UNDECIDED' then '未決定'
when str_hdr.push_to_kanzashi = 'NOPUSH' then 'かんざし連携なし'
else ks.pos_name
end as push_to_kanzashi
from store_transaction as str_hdr
left join store_transaction_details as str_dtl on str_hdr.transcode = str_dtl.transcode and str_hdr.keyno = str_dtl.keyno
left join store_services as str_svr on str_dtl.gcode = str_svr.gcode
Expand All @@ -3120,6 +3142,7 @@ function wsGetReservation($sessionid, $strcode, $origination, $datefr, $dateto,
join stafftype on stafftype.staffcode = stff.staffcode and stafftype.delflg is null or str_dtl.staffcode = 0
join storetype on storetype.delflg is null and storetype.storecode = str_hdr.storecode
left join store_transaction2 as str_trans2_hdr on str_hdr.transcode = str_trans2_hdr.transcode and str_hdr.keyno = str_trans2_hdr.keyno
left join sipssbeauty_kanzashi.salon ks on ks.pos_id = str_hdr.destination_kanzashi_salon_pos_id
where {$wherecond}
group by transcode
) as tmptbl
Expand Down

0 comments on commit 3cb9168

Please sign in to comment.