Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > PHP > PHP Forum > สอบถามเรื่องผลรวมในตารางแนวนอน ได้ยังไงครับทำแล้วมันไม่รวมกัน


[PHP] สอบถามเรื่องผลรวมในตารางแนวนอน ได้ยังไงครับทำแล้วมันไม่รวมกัน

 
Topic : 136915



โพสกระทู้ ( 45 )
บทความ ( 0 )



สถานะออฟไลน์



ot
จริงๆผลรวมต้องได้ 6 เพราะบวกทั้ง3วัน แต่มันออกมาแค่2
code ที่ใช้คำนวณชั่วโมง OT อยู่ตรงนี้ครับ tag /*-----คำนวณ OT ของแต่ละวัน -----*/
Code (PHP)
001.<?php
002. 
003.@ini_set('display_errors', '0');
004.include "../../include/mySqlFunc.php";
005.date_default_timezone_set("Asia/Bangkok");
006.query("USE hr_extra");
007.$date_start = '2022-12-01';
008.$date_end = '2022-12-03';
009.$rate_per_day = 325;
010. 
011.//setcookie("d",$_POST['date_in'],time()+3600);
012.//print $_COOKIE["d"];
013. 
014.if ($_GET["Action"] == "Add") {
015. 
016.    $multiple_advance = $_POST['multiple_advance'];
017.    $multiple_ar = $_POST['multiple_ar'];
018.    /*for($i=0;$i<sizeof($multiple_advance);$i++)
019.{
020.print($multiple_advance[$i]."<br>");
021.}*/
022. 
023.}
024. 
025.for ($intern = 0; $intern < sizeof($multiple_advance); $intern++) {
026.    if (!empty($multiple_advance[$intern])) {
027.        if (empty($where_data)) {
028.            $where_data = $multiple_advance[$intern];
029.        } else {
030.            $where_data .= "," . $multiple_advance[$intern];
031.        }
032.    }
033.}
034. 
035.for ($intern = 0; $intern < sizeof($multiple_ar); $intern++) {
036.    if (!empty($multiple_ar[$intern])) {
037.        if (empty($where_data2)) {
038.            $where_data2 = $multiple_ar[$intern];
039.        } else {
040.            $where_data2 .= "," . $multiple_ar[$intern];
041.        }
042.    }
043.}
044. 
045.//print($where_data);
046. 
047.$thai_day_arr = array("อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัสบดี", "ศุกร์", "เสาร์");
048. 
049.$cut_start_date = explode("-", $date_start);
050.$DateStart = $cut_start_date[2]; //วันเริ่มต้น
051.$MonthStart = $cut_start_date[1]; //เดือนเริ่มต้น
052.$YearStart = $cut_start_date[0]; //ปีเริ่มต้น
053. 
054.$cut_end_date = explode("-", $date_end);
055.$DateEnd = $cut_end_date[2]; //วันสิ้นสุด
056.$MonthEnd = $cut_end_date[1]; //เดือนสิ้นสุด
057.$YearEnd = $cut_end_date[0]; //ปีสิ้นสุด
058. 
059.$End = mktime(0, 0, 0, $MonthEnd, $DateEnd, $YearEnd);
060.$Start = mktime(0, 0, 0, $MonthStart, $DateStart, $YearStart);
061. 
062.$DateNum = ceil(($End - $Start) / 86400) + 1; // 28
063.$colspan_table = $DateNum + 5;
064.//print($DateNum);
065. 
066.$color = "#FFB6C1";
067.?>
068. 
069.<!DOCTYPE html>
070.<html lang="th">
071.<head>
072.    <meta charset="UTF-8">
073.    <!-- Title Page-->
074.    <title>รายงานสรุปค่าแรง คนสวน</title>
075.    <!-- Fontfaces CSS-->
076.    <link href="../css/font-face.css" rel="stylesheet" media="all">
077.    <!-- Bootstrap CSS-->
078.    <link rel="stylesheet" type = "text/css" href = "../bootstrap/bootstrap.min.css">
079.    <style type="text/css">
080. 
081.    @font-face {
082.    font-family: 'mn_forsor_ttbold';
083.    src: url('../fonts/mn_forsor_tt_bd_v3.2.1-webfont.woff2') format('woff2'),
084.         url('../fonts/mn_forsor_tt_bd_v3.2.1-webfont.woff') format('woff');
085.    font-weight: normal;
086.    font-style: normal;
087.    }
088. 
089.    @font-face {
090.    font-family: 'mn_forsor_ttextrabd';
091.    src: url('../fonts/mn_forsor_tt_extrabd_v3.2.1-webfont.woff2') format('woff2'),
092.         url('../fonts/mn_forsor_tt_extrabd_v3.2.1-webfont.woff') format('woff');
093.    font-weight: normal;
094.    font-style: normal;
095.    }
096. 
097.    table {
098.        font-family: 'mn_forsor_ttbold';
099.        font-size: 18px;
100.    }
101. 
102.    .caption table {
103.        font-size: 24px;
104.        color: black;
105.    }
106. 
107.    .text-center
108.    {
109.        text-align: left;
110.        padding-left: 26%;
111.    }
112. 
113.@media print
114.{
115.    /*-webkit-print-color-adjust: exact;*/
116.    .bodytable{
117.    height: auto;
118.    }
119. 
120.    /* class ซ่อนสิ่งที่ไม่อยากให้ติดตอนปริ้น */
121.    .noprint{
122.    visibility: hidden;
123.    display: none;
124.    }
125. 
126.    #non-printable
127.    {
128.        display: none;
129.    }
130. 
131.    #printable { display: block; }
132.}
133. 
134..form-control, output {
135.    font-size: 20px;
136.    line-height: 1.42857143;
137.    color: #555;
138.    display: block;
139.}
140. 
141.    </style>
142.</head>
143.<body>
144.<form action="<?=$_SERVER["PHP_SELF"];?>?Action=Add" method="POST" name="report_garden3">
145.<?php
146.print("<input type='hidden' name='date_in' value=\"" . $_POST['date_in'] . "\">");
147.print("<input type='hidden' name='date_end' value=\"" . $_POST['date_end'] . "\">");
148. 
149.print("<center>");
150.print("<div class=\"caption\">");
151.print("<table border=\"0\" style=\"text-align:center;\">");
152.print("<tr>");
153.print("<td>");
154.print("บัญชีค่าแรงและวันทำงาน");
155.print("</td>");
156.print("</tr>");
157.print("<tr>");
158.print("<td>");
159.print("ผู้รับเหมาคนสวน");
160.print("</td>");
161.print("</tr>");
162.print("<tr>");
163.print("<td>");
164.print("ประจำวันที่ " . printlongSlateThaiDate($date_start) . " ถึงวันที่ " . printlongSlateThaiDate($date_end));
165.print("</td>");
166.print("</tr>");
167.print("</table>");
168.print("</div>");
169.print("<table border='1' style=\"text-align:center; width:95%;\" >");
170./*----- ส่วนหัวตาราง -----*/
171.print("<tr>");
172. 
173.print("<td rowspan='3' style=\"width:3%;\">");
174.print("ลำดับที่");
175.print("</td>");
176.print("<td rowspan='3' style=\"width:3%;\">");
177.print("เลขบัตร");
178.print("</td>");
179. 
180.print("<td rowspan='3' style=\"width:10%;\">");
181.print("ชื่อ - สกุล");
182.print("</td>");
183. 
184.print("<td colspan=\"$DateNum\" style=\"width:50%;\">");
185.print("บันทึกเวลาทำงาน");
186.print("</td>");
187. 
188.print("<td rowspan='3' style=\"width:3%;\">");
189.print("จำนวนวันทำงาน");
190.print("</td>");
191. 
192.print("<td rowspan='3' style=\"width:5%;\">");
193.print("ค่าจ้าง");
194.print("</td>");
195. 
196.print("<td rowspan='3' style=\"width:5%;\">");
197.print("ค่าจ้าง <br>(340)");
198.print("</td>");
199. 
200.print("<td colspan='2'>");
201.print("ค่าดำเนินการ");
202.print("</td>");
203.print("<td colspan='4'>");
204.print("วันทำงาน/ค่าล่วงเวลา");
205.print("</td>");
206. 
207.print("<td rowspan='3' style=\"width:3%;\">");
208.print("รวมรับ<br>ค่าล่วงเวลา");
209.print("</td>");
210. 
211.print("<td rowspan='3' style=\"width:3%;\">");
212.print("ค่าล่วง<br>เวลา 3%");
213.print("</td>");
214. 
215.print("<td rowspan='3' style=\"width:3%;\">");
216.print("รวมรับ");
217.print("</td>");
218.print("</tr>");
219. 
220./*----- ตัวย่อวัน -----*/
221.print("<tr>");
222. 
223.for ($i = 0; $i < $DateNum; $i++) {
224.    $cutdate_show = add_date($date_start, $i, 0, 0);
225.    $cutNew_date = explode(" ", $cutdate_show);
226.    $c = printThaiNameDate(strtotime($cutNew_date[0]));
227.    if ($c == "อา") {
228.        print("<td bgcolor=\"$color\" style=\"width:10mm; text-align:center; height:8mm;\">");
229.    } else {
230.        print("<td bgcolor=\"white\" style=\"width:10mm; text-align:center; height:8mm;\">");
231.    }
232.    print($c);
233.    print("</td>");
234.}
235.print("<td rowspan='2'>");
236.print("ฐานค่าจ้าง<br>(325)");
237.print("</td>");
238.print("<td rowspan='2'>");
239.print("เงินได้25%");
240.print("<td rowspan='2'>");
241.print("วันปกติ<br>(ชม.)");
242.print("</td>");
243.print("<td rowspan='2'>");
244.print("วันหยุด<br>(ชม.)");
245.print("</td>");
246.print("<td rowspan='2'>");
247.print("วันปกติ");
248.print("</td>");
249.print("<td rowspan='2'>");
250.print("วันหยุด");
251.print("</td>");
252.print("</td>");
253. 
254.print("</tr>");
255. 
256./*----- วันที่ -----*/
257.print("<tr>");
258.$date_show = 0;
259.for ($i = 0; $i < $DateNum; $i++) {
260.    $cutdate_show = add_date($date_start, $i, 0, 0);
261.    $cutNew_date = explode(" ", $cutdate_show);
262.    $c = printThaiNameDate(strtotime($cutNew_date[0]));
263.    //print($cutNew_date[0]);
264.    if ($c == "อา") {
265.        print("<td bgcolor=\"$color\" style=\"width:10mm; text-align:center; height:8mm;\">");
266.    } else {
267.        print("<td bgcolor=\"white\" style=\"width:10mm; text-align:center; height:8mm;\">");
268.    }
269.    $date_show = ((int) date('d', strtotime($cutNew_date[0])));
270.    print("$date_show");
271.    print("</td>");
272.}
273.print("</tr>");
274. 
275./*----- จบส่วนหัวตาราง -----*/
276. 
277.$get_data = getlist("SELECT * FROM emp_data AS ed WHERE emp_position ='คนสวน'");
278.$order = 0;
279.$result_salary_intern2 = 0;
280.for ($i = 0; $i < sizeof($get_data); $i++) {
281.    print("<tr>");
282.    //ลำดับ
283.    print("<td>");
284.    print($order = $i + 1);
285.    //print($get_data[$i]['emp_id']);
286.    print("</td>");
287.    /*-----รหัส------*/
288.    print("<td style=\"text-align:left; padding-left:10px;\">");
289.    print($get_data[$i]['emp_id']);
290.    print("</td>");
291. 
292.    /*----- ชื่อ-สกุล -----*/
293.    print("<td style=\"text-align:left; padding-left:10px;\">");
294.    print($get_data[$i]['emp_prefix'] . $get_data[$i]['emp_fname'] . " " . $get_data[$i]['emp_lname']);
295.    print("</td>");
296. 
297.    $show_total_day = 0; //ตัวแปรเก็บค่าวันทำงานทั้งหมดของคนสวน คนนั้นๆ
298.    $show_total_day_holiday = 0; //ตัวแปรเก็บค่าวันทำงานในวันหยุด
299.    $show_total_hours = 0; //ตัวแปรเก็บค่าชั่วโมงที่มาทำงานในวันที่สาย
300.    /*----- for check วันทำงาน -----*/
301.    for ($j = 0; $j < $DateNum; $j++) {
302.        $cutdate_show = add_date($date_start, $j, 0, 0);
303.        $cutNew_date = explode(" ", $cutdate_show);
304.        $c = printThaiNameDate(strtotime($cutNew_date[0]));
305.        // print($cutNew_date[0]);
306.        // print("<br>");
307. 
308.        $getlist_cout = getlist("SELECT * FROM emp_process
309.        WHERE process_date = '" . $cutNew_date[0] . "' AND emp_id='" . $get_data[$i]['emp_id'] . "' ");
310.        //print("SELECT * FROM emp_process WHERE process_date = '" . $cutNew_date[0] . "' AND emp_id='" . $get_data[$i]['emp_id'] . "' ");
311.        if ($c == "อา") {
312.            print("<td bgcolor=\"$color\">");
313.        } else {
314.            print("<td bgcolor=\"white\">");
315.        }
316. 
317.        /*----- มาทำงาน -----*/
318.        if (!empty($getlist_cout)) {
319.            //เวลาที่ทำงาน
320.            $sum_ot_hr = 0;
321.            $get_time_max_min = getlist("SELECT MAX(process_time) AS time_max , MIN(process_time) AS time_min , process_status AS status
322.            FROM emp_process WHERE emp_id='" . $get_data[$i]['emp_id'] . "'
323.            AND process_date='" . $cutNew_date[0] . "'");
324. 
325.            /*-----คำนวณ OT ของแต่ละวัน -----*/
326.            
327.            $get_timediff = getlist("SELECT TIMEDIFF('" . $get_time_max_min[0]['time_max'] . "','17:00:00') AS time_less");
328.            
329.            //print($get_timediff[0]['time_less']);
330. 
331.            if ($get_timediff[0]['time_less'] == '00:00:00' && $get_timediff[0]['time_less'] < '01:00:00' && $c != 'อา') {
332.                $people_hour = 0;
333.            } elseif ($get_timediff[0]['time_less'] >= '02:00:00' && $get_timediff[0]['time_less'] < '02:30:00' && $c != 'อา') {
334.                $people_hour = 2;
335.            }
336. 
337.            $sum_ot_hr += $people_hour;
338.            //print_r($ot_h);
339.            print("จำนวน OT(" . $people_hour . ")ชม.<br>"); //ชั่วโมงที่ทำ OT
340. 
341.            /*-----คำนวณ OT ของแต่ละวัน -----*/
342.            //("'" $get_data[$i]['emp_id'] . "'AND process_date='" . $cutNew_date[0] . "'");*/
343. 
344.            $get_process_midday = getlist("SELECT * FROM emp_process
345.            WHERE emp_id='" . $get_data[$i]['emp_id'] . "'
346.            AND process_date='" . $cutNew_date[0] . "' ORDER BY process_time");
347. 
348.            //กรณีสาย
349.            if ($get_time_max_min[0]['time_min'] > '08:00:00' && $c != 'อา') {
350. 
351.                $time_less = getlist("SELECT TIMEDIFF((SELECT TIMEDIFF('17:00:00','" . $get_time_max_min[0]['time_min'] . "')),'01:00:00') AS time_less");
352.                //print("SELECT TIMEDIFF((SELECT TIMEDIFF('17:00:00','" . $get_time_max_min[0]['time_min'] . "')),'01:00:00') AS time_less");
353.                //print($time_less[0]['time_less']);
354.                $time_less_result = explode(":", $time_less[0]['time_less']);
355.                if ($time_less_result[1] < 30) {
356.                    $result_late = $time_less_result[0];
357.                    print($result_late . "");
358.                } else if ($time_less_result[1] >= 30) {
359.                    $result_late = number_format($time_less_result[0]) + 0.5;
360.                    print($result_late . "ชม.");
361.                }
362.                /*----- + วันทำงาน -----*/
363.                $show_total_hours += $result_late;
364.            }
365.            //สายและวันอาทิตย์
366.            if ($get_time_max_min[0]['time_min'] > '08:00:00' && $c == 'อา') {
367.                print("-");
368.            }
369.            /*if($get_time_max_min[0]['time_max'] >= '18:00:00')
370.            {
371.            print("/OT");
372.            }*/
373. 
374.            //ไม่สายและวันอาทิตย์
375.            else if ($get_time_max_min[0]['time_min'] <= '08:00:00' && $c == 'อา') {
376.                $result_late = 0;
377.                $result_holiday = 0;
378.                print("1");
379. 
380.                /*if($get_time_max_min[0]['time_max'] >= '18:00:00')
381.                {
382.                print("/OT");
383.                }*/
384.                //print($result_late);
385.                /*----- + วันทำงาน -----*/
386.                $show_total_day += $result_late;
387.                $show_total_day_holiday += $result_holiday;
388.            }
389. 
390.            //ไม่สายแต่กลับก่อน 17:00:00
391.            else if ($get_time_max_min[0]['time_min'] <= '08:00:00' && $get_time_max_min[0]['time_max'] < '17:00:00' && $get_time_max_min[0]['time_max'] != $get_time_max_min[0]['time_min']) {
392.                //print $get_time_max_min[0]['time_max'];
393.                $time_less = getlist("SELECT TIMEDIFF((SELECT TIMEDIFF('" . $get_time_max_min[0]['time_max'] . "','08:00:00')),'01:00:00') AS time_less");
394.                $result_late = number_format($time_less[0]['time_less']);
395.                print($result_late . "ชม.");
396.                $show_total_hours += $result_late;
397.            }
398. 
399.            //ไม่สายแต่ยังไม่ได้แสกนบัตรออก
400.            else if ($get_time_max_min[0]['time_min'] <= '08:00:00' && $get_time_max_min[0]['time_max'] < '17:00:00' && $get_time_max_min[0]['time_max'] == $get_time_max_min[0]['time_min']) {
401.                $result_late = 1;
402.                print("<font color='blue'>" . $result_late . "</font>");
403.                /*----- + วันทำงาน -----*/
404.                $show_total_day += $result_late;
405.            }
406. 
407.            //เงื่อนไขตรวจสอบว่า วันนี้มีการเข้า-ออก พักเที่ยงไหม
408.            else if (sizeof($get_process_midday) == 4) {
409.                //print($get_process_midday[0]['process_time']."<br>");
410.                //print($get_process_midday[1]['process_time']."<br>");
411.                //print($get_process_midday[2]['process_time']."<br>");
412.                //print($get_process_midday[3]['process_time']."<br>");
413. 
414.                //เงื่อนไข แสกนเข้าพักกอ่นเวลา 12.00
415.                if ($get_process_midday[1]['process_time'] < '12:00:00') {
416.                    //print("yes");
417.                    $time_midday = getlist("SELECT TIMEDIFF('" . $get_process_midday[1]['process_time'] . "','08:00:00') AS time_midday");
418.                    //print ($time_midday[0]['time_midday']."<br>");
419. 
420.                    $time_midday2 = getlist("SELECT TIMEDIFF('" . $get_process_midday[3]['process_time'] . "','13:00:00') AS time_midday2");
421.                    //print($time_midday2[0]['time_midday2']);
422. 
423.                    $time_midday_explode = explode(":", $time_midday[0]['time_midday']);
424.                    //print($time_midday_explode[1]);
425.                    if ($time_midday_explode[1] >= 30) {
426.                        $time_midday_explode_minute = 0.5;
427.                    } else {
428.                        $time_midday_explode_minute = 0;
429.                    }
430. 
431.                    $time_midday_total = ($time_midday[0]['time_midday']) + ($time_midday2[0]['time_midday2']);
432.                    $show_total_hours = $time_midday_total + $time_midday_explode_minute;
433.                    print($show_total_hours);
434. 
435.                }
436. 
437.                //เงื่อนไข แสกนเข้าหลัง 12.59 ไหม
438.                if ($get_process_midday[2]['process_time'] > '12:59:00') {
439.                    $time_less_result = explode(":", $get_process_midday[2]['process_time']);
440.                    //print($time_less_result[1]);
441.                    //เงื่อนไขปัดเศษ 1 - 30 ปัดนาทีเป็น 30 นาที
442.                    if ($time_less_result[1] >= 1 && $time_less_result[1] <= 30) {
443. 
444.                        $time_cal = ($time_less_result[0] . ":" . "30" . ":" . "00");
445.                        //print($time_less_result[0].":"."30".":"."00");
446.                    }
447.                    //เงื่อนไขปัดเศษ 31 - 59 ปัดนาทีเป็น 1 ชั่วโมง
448.                    else if ($time_less_result[1] >= 31 && $time_less_result[1] <= 59) {
449.                        $time_less_result[0] += 1;
450.                        $time_cal = ($time_less_result[0] . ":" . "00" . ":" . "00");
451.                    }
452.                    $time_less_2_total = getlist("SELECT TIMEDIFF('" . $time_cal . "','13:00:00') AS time_less_2_total");
453.                    $time_less_3_total = getlist("SELECT TIMEDIFF('08:00:00','" . $time_less_2_total[0]['time_less_2_total'] . "') AS time_less_3_total");
454.                    //print($time_less_3_total[0]['time_less_3_total']);
455.                    $result_late = ($time_less_3_total[0]['time_less_3_total']);
456.                    //print($result_late);
457.                    $result_late2 = explode(":", $result_late);
458. 
459.                    //ถ้ามีเศษ 30 นาทีให้แปลงเป็น 0.5
460.                    if ($result_late2[1] == 30) {
461.                        $result_late3 = $result_late2[0] + 0.5;
462.                    }
463.                    //ถ้าปกติ
464.                    else {
465.                        $result_late3 = $result_late2[0];
466.                    }
467. 
468.                    $show_total_hours += $result_late3;
469.                    print($show_total_hours);
470.                }
471.                //เงื่อนไข แสกนออกไปพักมากกว่าหรือเท่ากับ 12.00 ไหม และ แสกนเข้าก่อน 12.59 ไหม
472.                else if ($get_process_midday[1]['process_time'] >= '12:00:00' && $get_process_midday[2]['process_time'] <= '12:59:00') {
473.                    //print("yes");
474.                    $result_late = 1;
475.                    print($result_late);
476.                    $show_total_day += $result_late;
477.                }
478.            }
479.            //ไม่สายเลย+ไม่ขาดงาน
480.            else {
481.                $result_late = 1;
482.                print($result_late);
483.                /*----- + วันทำงาน -----*/
484.                /*if($get_time_max_min[0]['time_max'] >= '18:00:00')
485.                {
486.                print("/OT");
487.                }*/
488. 
489.                $show_total_day += $result_late;
490.            }
491.        }
492. 
493.        //ไม่มาทำงาน
494.        else {
495.            //print("-");
496.            if ($c == "อา") {
497.                print("-");
498.            }
499.            //กรณีจะเพิ่มวันทำงานล่วงหน้า รายคน
500.            else {
501.                $result_late = 1;
502.                //print("<font color='red'>เพิ่ม</font>");
503.                print("ไม่มาทำงาน");
504.                print("</a>");
505.                //$show_total_day += $result_late;
506.            }
507.        }
508.        print("</td>");
509.    }
510. 
511.    /*----- จำนวนวันทำงาน -----*/
512.    print("<td style=\"text-align:center; padding-left:0,px;\">");
513.    /*
514.    print($show_total_day." วัน");
515.    //if วันไหนมีชม. ให้แสดง
516.    if($show_total_hours != 0)
517.    {
518.    print("<br>".$show_total_hours." ชม");
519.    }
520.     */
521. 
522.    //if วันไหนมีชม. ให้แสดง
523.    if ($show_total_hours != 0) {
524.        //ถ้า ชม. มากกว่า 8 หรือเท่ากัน
525.        if ($show_total_hours >= 8) {
526.            $hours_balance = $show_total_hours - 8;
527.            $show_total_day += 1;
528.        } else {
529.            $hours_balance += $show_total_hours;
530.        }
531.        print($show_total_day . " วัน");
532.        print("<br>" . $hours_balance . " ชม");
533.    } else if ($show_total_hours == 0) {
534.        print($show_total_day . " วัน");
535.    }
536.    print("</td>");
537. 
538.    /*----- อัตราค่าจ้าง -----*/
539.    print("<td>");
540.    print("340");
541.    print("</td>");
542.    /*--------ค่าจ้าง 340------*/
543.    print("<td>");
544.    $sum_today = $show_total_day * 340;
545.    print(number_format($sum_today));
546.    print("</td>");
547.    /*--------ฐานค่าจ้าง(ผู้ดำเนินการ) 325------*/
548.    print("<td>");
549.    $sum_opcost = $show_total_day * 325;
550.    print(number_format($sum_opcost));
551.    print("</td>");
552.    /*--------เงินได้ 25% (ผู้ดำเนินการ)------*/
553.    print("<td>");
554.    $sum_monney = ($sum_opcost * 25) / 100;
555.    print(number_format($sum_monney, 2, '.', ','));
556.    print("</td>");
557. 
558.    print("<td>");
559.    print($sum_ot_hr);
560.    print("</td>");
561. 
562.    print("<td>");
563.    print($ot_hours_weekend . " ชม.");
564.    print("</td>");
565. 
566.    print("<td>");
567.    $sum_ot = ((340 / 8) * 1.5) * $ot_hours;
568.    print(number_format($sum_ot, 2, '.', ','));
569.    print("</td>");
570. 
571.    print("<td>");
572.    print("325");
573.    print("</td>");
574. 
575.    print("<td>");
576.    print("325");
577.    print("</td>");
578. 
579.    print("<td>");
580.    print("325");
581.    print("</td>");
582. 
583.    /*----- รวมจำนวนเงิน -----*/
584.    print("<td>");
585.    $show_total_hours2 = $hours_balance * 40; //ตัวแปรเก็บชม. เมื่อทำงานไม่เต็มวัน
586.    print($hours_balance . "<br>");
587.    print($show_total_hours2);
588.    print("<br>");
589.    $result_salary_garden = ($show_total_day * $rate_per_day) + $show_total_hours2;
590.    print number_format($result_salary_garden);
591.    print("</td>");
592. 
593.    $result_salary_garden2 += $result_salary_garden;
594.    print("</tr>");
595.    $hours_balance = 0;
596.    /*-----รวมเงินค่าจ้าง 340 -----*/
597.    $total_today += $sum_today;
598. 
599.    /*-----รวมเงินค่าดำเนินการ 325 -----*/
600.    $total_opcpst += $sum_opcost;
601. 
602.    /*-----เงินได้ 25% -----*/
603.    $total_money += $sum_monney;
604. 
605.}
606. 
607.print("<tr>");
608.print("<td colspan=\"$colspan_table\">");
609.print("ยอดรวมทั้งหมด");
610.print("</td>");
611.print("<td>");
612.print number_format($total_today);
613.print("</td>");
614.print("<td>");
615.print number_format($total_opcpst);
616.print("</td>");
617.print("<td>");
618.print(number_format($total_money, 2, '.', ','));
619.print("</td>");
620.print("<td>");
621.print number_format($total_ot);
622.print("</td>");
623.print("<td>");
624.print number_format($result_salary_garden2);
625.print("</td>");
626.print("</tr>");
627. 
628.print("<br>");
629.print("<br>");
630./*print("<table border='1' style=\"text-align:center; width:20%;\" >");
631.print("<tr>");
632.print("<td  style=\"width:3%;\">");
633.print("เงินได้รวมรับทั้งหมด");
634.print("</td>");
635.print("<td  style=\"width:3%;\">");
636.print("-");
637.print("</td>");
638.print("</tr>");
639.print("<tr>");
640.print("<td style=\"width:3%;\">");
641.print("เงินค่าดำเนินการ 25%");
642.print("</td>");
643.print("<td  style=\"width:3%;\">");
644.print("-");
645.print("</td>");
646.print("<tr>");
647.print("<td  style=\"width:3%;\">");
648.print("เงินค่าดำเนินการ (ล่วงเวลา 3%)");
649.print("</td>");
650.print("<td  style=\"width:3%;\">");
651.print("-");
652.print("</td>");
653.print("</tr>");
654.print("<tr>");
655.print("<td  style=\"width:3%;\">");
656.print("เงินค่าดำเนินการเพิ่มเติม");
657.print("</td>");
658.print("<td  style=\"width:3%;\">");
659.print("-");
660.print("</td>");
661.print("</tr>");
662.print("<tr>");
663.print("<td  style=\"width:3%;\">");
664.print("รวมเงินได้ทั้งหมด");
665.print("</td>");
666.print("<td  style=\"width:3%;\">");
667.print("-");
668.print("</td>");
669.print("</tr>");
670.print("</table>");
671.print("<br>");
672.print("<br>");
673.print("<table border='1' style=\"text-align:center; width:20%;\" >");
674.print("<tr>");
675.print("<td  style=\"width:3%;\">");
676.print("หักภาษี ณ ที่จ่าย (3%)");
677.print("</td>");
678.print("<td  style=\"width:3%;\">");
679.print("-");
680.print("</td>");
681.print("</tr>");
682. 
683.print("<tr>");
684.print("<td  style=\"width:3%;\">");
685.print("ยอดรวมสุทธิ");
686.print("</td>");
687.print("<td  style=\"width:3%;\">");
688.print("-");
689.print("</td>");
690.print("</tr>");
691. 
692.print("</table>");*/
693.print("</center>");
694.print("</form>");
695.?>
696.</body>
697.</html>




Tag : PHP



ประวัติการแก้ไข
2022-12-27 10:21:21
2022-12-27 10:27:49
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2022-12-27 10:19:30 By : benlovehi5 View : 492 Reply : 3
 

 

No. 1



โพสกระทู้ ( 45 )
บทความ ( 0 )



สถานะออฟไลน์


.


ประวัติการแก้ไข
2022-12-27 10:58:10
2022-12-27 11:01:27
2022-12-27 11:01:32
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2022-12-27 10:57:40 By : benlovehi5
 

 

No. 2



โพสกระทู้ ( 1,994 )
บทความ ( 10 )



สถานะออฟไลน์
Facebook Blogger

จากรูป คือ ภาพมาไม่หมดครับ
การรวมก็ถูกนะครับ
วันปกติ 2 ชม.
วันหยุด 1 ชม.
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2022-12-28 10:07:30 By : {Cyberman}
 

 
นั่นสิ ผมก็งง แต่วันปกติมันต้อง 3 ชม.(ถ้ารวม ส.) ไม่ใช่หรือ
ที่ถามให้แน่ชัดก่อนเพื่อจะได้เข้าใจตรงกันก่อน
แล้วคอลัมน์ของ OT ทำไมไม่เอามาด้วย
หรือต้องการรวม OT ในเวลาปกติ
หรือยังไง...?
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2022-12-29 14:38:06 By : 009
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : สอบถามเรื่องผลรวมในตารางแนวนอน ได้ยังไงครับทำแล้วมันไม่รวมกัน
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่