";
echo "
";
echo "Date. | ";
echo "TREATMENT | ";
echo "DIALYZER | ";
echo "ERYTHROPOEITIN | ";
echo "MEDICINES | ";
echo "KIT | ";
echo "OTHERS | ";
echo "LABORATORY | ";
echo "SUPPLIES | ";
echo "TOTAL | ";
echo "
";
$begin = new DateTime($dateFrom);
$end = new DateTime($dateTo);
for($i = $begin; $i <= $end; $i->modify('+1 day')){
$ruNDate = $i->format("m/d/Y");
$getSalesTX = mysql_result(mysql_query("SELECT SUM(`payment_amount`) FROM `payments` WHERE `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='CASH' AND `cancel`='no' AND `payment_type`='Treatment' || `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='ADVANCE' AND `cancel`='no' AND `payment_type`='Treatment' "),0);
$getSalesTXTOTAL = $getSalesTXTOTAL + $getSalesTX;
$getSalesDIAL = mysql_result(mysql_query("SELECT SUM(`payment_amount`) FROM `payments` WHERE `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='CASH' AND `cancel`='no' AND `payment_type`='Dialyzer' || `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='ADVANCE' AND `cancel`='no' AND `payment_type`='Dialyzer' "),0);
$getSalesDIALTOTAL = $getSalesDIALTOTAL + $getSalesDIAL;
$getSalesEPO = mysql_result(mysql_query("SELECT SUM(`payment_amount`) FROM `payments` WHERE `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='CASH' AND `cancel`='no' AND `payment_type`='Epo' || `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='ADVANCE' AND `cancel`='no' AND `payment_type`='Epo' "),0);
$getSalesEPOTOTAL = $getSalesEPOTOTAL + $getSalesEPO;
$getSalesMED = mysql_result(mysql_query("SELECT SUM(`payment_amount`) FROM `payments` WHERE `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='CASH' AND `cancel`='no' AND `payment_type`='Medicine' || `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='ADVANCE' AND `cancel`='no' AND `payment_type`='Medicine' "),0);
$getSalesMEDTOTAL = $getSalesMEDTOTAL + $getSalesMED;
$getSaleKIT = mysql_result(mysql_query("SELECT SUM(`payment_amount`) FROM `payments` WHERE `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='CASH' AND `cancel`='no' AND `payment_type`='Kit' || `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='ADVANCE' AND `cancel`='no' AND `payment_type`='Kit' "),0);
$getSaleKITTOTAL = $getSaleKITTOTAL + $getSaleKIT;
$getSalesOTHERS = mysql_result(mysql_query("SELECT SUM(`payment_amount`) FROM `payments` WHERE `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='CASH' AND `cancel`='no' AND `payment_type`='Others' || `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='ADVANCE' AND `cancel`='no' AND `payment_type`='Others' "),0);
$getSalesOTHERSTOTAL = $getSalesOTHERSTOTAL + $getSalesOTHERS;
$getSalesSUP = mysql_result(mysql_query("SELECT SUM(`payment_amount`) FROM `payments` WHERE `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='CASH' AND `cancel`='no' AND `payment_type`='Supplies' || `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='ADVANCE' AND `cancel`='no' AND `payment_type`='Supplies' "),0);
$getSalesSUPTOTAL = $getSalesSUPTOTAL + $getSalesSUP;
$getSalesLAB = mysql_result(mysql_query("SELECT SUM(`payment_amount`) FROM `payments` WHERE `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='CASH' AND `cancel`='no' AND `payment_type`='Laboratory' || `branch_code`='$compCode' AND `payment_date`='$ruNDate' AND `payment_method`='ADVANCE' AND `cancel`='no' AND `payment_type`='Laboratory' "),0);
$getSalesLABTOTAL = $getSalesLABTOTAL + $getSalesLAB;
$dateSalesTotal = $getSalesTX + $getSalesDIAL + $getSalesEPO + $getSalesMED + $getSaleKIT + $getSalesOTHERS + $getSalesLAB + $getSalesSUP;
$grandTotal= $grandTotal + $dateSalesTotal;
echo "
";
echo "".$ruNDate." | ";
echo "".number_format($getSalesTX,2,'.',',')." | ";
echo "".number_format($getSalesDIAL,2,'.',',')." | ";
echo "".number_format($getSalesEPO,2,'.',',')." | ";
echo "".number_format($getSalesMED,2,'.',',')." | ";
echo "".number_format($getSaleKIT,2,'.',',')." | ";
echo "".number_format($getSalesOTHERS,2,'.',',')." | ";
echo "".number_format($getSalesLAB,2,'.',',')." | ";
echo "".number_format($getSalesSUP,2,'.',',')." | ";
echo "".number_format($dateSalesTotal,2,'.',',')." | ";
echo "
";
}
echo "
";
echo "TOTAL | ";
echo "".number_format($getSalesTXTOTAL,2,'.',',')." | ";
echo "".number_format($getSalesDIALTOTAL,2,'.',',')." | ";
echo "".number_format($getSalesEPOTOTAL,2,'.',',')." | ";
echo "".number_format($getSalesMEDTOTAL,2,'.',',')." | ";
echo "".number_format($getSaleKITTOTAL,2,'.',',')." | ";
echo "".number_format($getSalesOTHERSTOTAL,2,'.',',')." | ";
echo "".number_format($getSalesLABTOTAL,2,'.',',')." | ";
echo "".number_format($getSalesSUPTOTAL,2,'.',',')." | ";
echo "".number_format($grandTotal,2,'.',',')." | ";
echo "
";
echo "";
echo "
Print Version";
?>