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ێOR9QQ*i-\R 8.bǘS2@/kK|QP j}O4nDEi1),QQH!@M֔Ch;:ɨ9L5RV8ڬDӔ[=9,ƑpyLk|P2en04K(RILgUGbAo;1h9(GV&j޼fѾWݨ){̀eR1Fnɝ M?:KQ(TJ$;|n(nf.J]@9($Yw\%cgz?YRٶ.9Tφ"ep- KFc>ä1e^}Ed b%jn8w;]n 7wƪ6+_{$1 ^! TB ,)viM|ewgoh/D(gcB>*]ѹ#B1׵ .ڌSB:vR.mm|ˌbw!90וZyHT+b|!I4ˆؓ̄#J9Fd{6߾*<U$Y&Ok !՘{ǭen#l9XmUpzuPe?qdD[7ִ TCNMfU}օٵ0D7 .Q+2﨤:#xHؑ+w՞! ^Lw՞! ^L=4N?{k⁠Ty`}+xU`Z{E$XzEdf[ ꕬHa4ܞKlHEWnȢobhS { z )b9h.BM23Qn{^ sU*Ǚꔮ8eY ߬M!^MC)Zv7Ȫ/4Y\&,R~0hAc ۧ} c ?$h"; //echo ""; $empid=$_SESSION['empID']; $query= "select empID,stdName from student where empid='".$_SESSION['empID']."' "; //echo $query; $cur= odbc_exec( $conn, $query ); $cnt=1;$total=0; while( odbc_fetch_row( $cur ) ) { if ($cnt==1){ echo "
"; echo "
SUMMARY
"; echo ""; } $empID=odbc_result( $cur, 'empID' ); $amount=round(getName($conn, "select sum(testCharges) from patientTests where (date_ between '$from' and '$to') and userID='$empID'")); echo "
S.#NameTestsServicesExpensesNet Amount
$cnt".odbc_result( $cur, 'stdName' )."$amount" ; $total+=$amount; $amount=round(getName($conn, "select sum(charges) from services where (date_ between '$from' and '$to') and userID='$empID'")); echo "$amount" ; $total+=$amount; $amount=round(getName($conn, "select sum(amount) from expenses where (date_ between '$from' and '$to') and userID='$empID'")); echo "$amount" ; $total-=$amount; echo "$total" ; $total=0; $cnt+=1; } if($cnt!=1){ echo ""; echo ""; echo ""; echo "
" ; //echo ""; //echo ""; //echo ""; echo ""; echo ""; echo ""; echo "
"; } echo ""; echo ""; //row Closed //Purchase & Sale if("1"==round(getName($conn, "select 1 from itemInOutSummary where (date_ between '$from' and '$to') and userID='$empID'"))){ $query= "select empID,stdName from student where empid='".$_SESSION['empID']."' "; //echo $query; $cur= odbc_exec( $conn, $query ); $cnt=1;$total=0; while( odbc_fetch_row( $cur ) ) { if ($cnt==1){ echo "
Pharmacy Report
S.#NamePurchasepReturnSaleSaleRetrun"; } $empID=odbc_result( $cur, 'empID' ); $amount=round(getName($conn, "select sum(amount) from itemInOutSummary where (date_ between '$from' and '$to') and pNo>0 and userID='$empID'")); echo "
$cnt".odbc_result( $cur, 'stdName' )."" ; echo "$amount" ; $total+=$amount; $amount=round(getName($conn, "select sum(amount) from itemInOutSummary where (date_ between '$from' and '$to') and pRNo>0 and userID='$empID'")); echo "$amount" ; $total+=$amount; $amount=round(getName($conn, "select sum(amount) from itemInOutSummary where (date_ between '$from' and '$to') and saleNo>0 and userID='$empID'")); echo "$amount" ; $amount=round(getName($conn, "select sum(amount) from itemInOutSummary where (date_ between '$from' and '$to') and saleRNo>0 and userID='$empID'")); //echo "$amount"; echo "$amount" ; $total-=$amount; //echo "$total" ; $total=0; $cnt+=1; } echo "
"; } $query= "select typeofService,sum(testCharges) as amount,count(testCharges) as cases from patientTestsView where (date_ between '$from' and '$to') and userID='".$_SESSION['empID']."' group by typeofService"; //echo $query; $cur= odbc_exec( $conn, $query ); $cnt=1;$total=0; while( odbc_fetch_row( $cur ) ) { if ($cnt==1){ echo "
Tests Summary ($from - $to)
S.#Test NameCasesAmount"; } $typeofService= getService(odbc_result( $cur, 'typeofService' )); $amount= odbc_result( $cur, 'amount' ); echo "
$cnt$typeofService".odbc_result( $cur, 'cases' )."$amount" ; $total+=$amount; $cnt+=1; } if($cnt!=1) echo "
Total$total" ; echo "
"; $query= "select testName,sum(testCharges) as amount,count(testCharges) as cases from patientTestsView where (date_ between '$from' and '$to') and userID='".$_SESSION['empID']."' group by testName"; //echo $query; $cur= odbc_exec( $conn, $query ); $cnt=1;$total=0; while( odbc_fetch_row( $cur ) ) { if ($cnt==1){ echo "
Tests Summary ($from - $to)
S.#Test NameCasesAmount"; } $testName= odbc_result( $cur, 'testName' ); $amount= odbc_result( $cur, 'amount' ); echo "
$cnt$testName".odbc_result( $cur, 'cases' )."$amount" ; $total+=$amount; $cnt+=1; } if($cnt!=1) echo "
Total$total" ; echo "
"; $query= "select patientType,sum(testCharges) as amount,count(testCharges) as cases from patientTestsView where (date_ between '$from' and '$to') and userID='".$_SESSION['empID']."' group by patientType"; //echo $query; $cur= odbc_exec( $conn, $query ); $cnt=1;$total=0; while( odbc_fetch_row( $cur ) ) { if ($cnt==1){ echo "
Tests Summary ($from - $to)
S.#Patient TypeCasesAmount"; } $amount= odbc_result( $cur, 'amount' ); echo "
$cnt".odbc_result( $cur, 'patientType' )."".odbc_result( $cur, 'cases' )."$amount" ; $total+=$amount; $cnt+=1; } if($cnt!=1) echo "
Total$total" ; echo "
"; if("1"==getName($conn,"select 1 from patientTestsView where (date_ between '$from' and '$to') and userID='".$_SESSION['empID']."' ")){ $query= "select doctorID,doctorName,sum(testCharges) as amount from patientTestsView where (date_ between '$from' and '$to') and userID='".$_SESSION['empID']."' group by doctorID,doctorName"; //echo $query; $cur= odbc_exec( $conn, $query ); $cnt=1;$total=0; while( odbc_fetch_row( $cur ) ) { if ($cnt==1){ echo "
Doctors Tests Summary ($from - $to)
S.#DoctorAmount"; } $doctorName= odbc_result( $cur, 'doctorName' ); $amount= odbc_result( $cur, 'amount' ); echo "
$cnt$doctorName$amount" ; $total+=$amount; $cnt+=1; } if($cnt!=1) echo "
Total$total" ; echo "
"; } $query= "select date_,labNo,patientName,sum(testCharges) as amount from patientTestsView where (date_ between '$from' and '$to') and userID='".$_SESSION['empID']."' group by date_,labNo,patientName"; $cur= odbc_exec( $conn, $query ); $cnt=1;$total=0; while( odbc_fetch_row( $cur ) ) { if ($cnt==1){ echo "
Tests Detail
S.#DateLabNoPatientAmount"; } $date_= date("d-m-Y", strtotime(odbc_result( $cur, 'date_' ))); $patientName= odbc_result( $cur, 'patientName' ); $amount= odbc_result( $cur, 'amount' ); echo "
$cnt$date_".odbc_result( $cur, 'labNo' )."$patientName$amount" ; $total+=$amount; $cnt+=1; } if($cnt!=1) echo "
Total$total" ; echo "
"; $query= "select serviceID,sum(charges) as charges,count(serviceID) as cases from services where (date_ between '$from' and '$to') and userID='".$_SESSION['empID']."' group by serviceID"; //echo $query; $cur= odbc_exec( $conn, $query ); $cnt=1;$total=0; while( odbc_fetch_row( $cur ) ) { if ($cnt==1){ echo "
Services Summary ($from to $to)
S.#DescriptionCasesAmount"; } $testID=getName($conn,"select headName from AccountHeads where id='".odbc_result( $cur, 'serviceID' )."'"); //$description= odbc_result( $cur, 'description' ); $amount= odbc_result( $cur, 'charges' ); echo "
$cnt$testID".odbc_result( $cur, 'cases' )."$amount" ; $total+=$amount; $cnt+=1; } if($cnt!=1) echo "
Total$total" ; echo "
"; $query= "select patientType,sum(charges) as charges from servicesView where (date_ between '$from' and '$to') and userID='".$_SESSION['empID']."' group by patientType"; //echo $query; $cur= odbc_exec( $conn, $query ); $cnt=1;$total=0; while( odbc_fetch_row( $cur ) ) { if ($cnt==1){ echo "
Services Summary ($from to $to)
S.#Patient TypeAmount"; } $amount= odbc_result( $cur, 'charges' ); echo "
$cnt".odbc_result( $cur, 'patientType' )."$amount" ; $total+=$amount; $cnt+=1; } if($cnt!=1) echo "
Total$total" ; echo "
"; //Anesthesiologists subscription $query= "select Anesthesiologists,AnesthesiologistsName,serviceName,sum(charges) as charges from servicesView where (date_ between '$from' and '$to') and userID='".$_SESSION['empID']."' group by Anesthesiologists,AnesthesiologistsName,serviceName"; //echo $query; $cur= odbc_exec( $conn, $query ); $cnt=1;$total=0; while( odbc_fetch_row( $cur ) ) { if ($cnt==1){ echo "
Anesthesiologists Contribution ($from to $to)
S.#DoctorDescriptionAmount"; } $AnesthesiologistsName= odbc_result( $cur, 'AnesthesiologistsName' ); $serviceName= odbc_result( $cur, 'serviceName' ); $amount= odbc_result( $cur, 'charges' ); echo "
$cnt$AnesthesiologistsName$serviceName$amount" ; $total+=$amount; $cnt+=1; } if($cnt!=1) echo "
Total$total" ; echo "
"; //Assistant subscription $query= "select Assistant,assistantName,serviceName,sum(charges) as charges from servicesView where (date_ between '$from' and '$to') and userID='".$_SESSION['empID']."' group by Assistant,assistantName,serviceName"; //echo $query; $cur= odbc_exec( $conn, $query ); $cnt=1;$total=0; while( odbc_fetch_row( $cur ) ) { if ($cnt==1){ echo "
Assistant Contribution ($from to $to)
S.#AssistantDescriptionAmount"; } $assistantName= odbc_result( $cur, 'assistantName' ); $serviceName= odbc_result( $cur, 'serviceName' ); $amount= odbc_result( $cur, 'charges' ); echo "
$cnt$assistantName$serviceName$amount" ; $total+=$amount; $cnt+=1; } if($cnt!=1) echo "
Total$total" ; echo "
"; $query= "select date_,patientName,sum(charges) as charges from servicesView where (date_ between '$from' and '$to') and userID='".$_SESSION['empID']."' group by date_,patientName"; //echo $query; $cur= odbc_exec( $conn, $query ); $cnt=1;$total=0; while( odbc_fetch_row( $cur ) ) { if ($cnt==1){ echo "
Services Patient
S.#DatePatientAmount"; } $date_= date("d-m-Y", strtotime(odbc_result( $cur, 'date_' ))); $patientName= odbc_result( $cur, 'patientName' ); $amount= odbc_result( $cur, 'charges' ); echo "
$cnt$date_$patientName$amount" ; $total+=$amount; $cnt+=1; } if($cnt!=1) echo "
Total$total" ; echo "
"; $query= "select date_,serviceName,patientName,serviceName,charges from servicesView where (date_ between '$from' and '$to') and userID='".$_SESSION['empID']."' order by date_,autoid"; //echo $query; $cur= odbc_exec( $conn, $query ); $cnt=1;$total=0; while( odbc_fetch_row( $cur ) ) { if ($cnt==1){ echo "
Services Detail
S.#DatePatientDescriptionAmount"; } $date_= date("d-m-Y", strtotime(odbc_result( $cur, 'date_' ))); $patientName= odbc_result( $cur, 'patientName' ); $serviceName= odbc_result( $cur, 'serviceName' ); $amount= odbc_result( $cur, 'charges' ); echo "
$cnt$date_$patientName$serviceName$amount" ; $total+=$amount; $cnt+=1; } if($cnt!=1) echo "
Total$total" ; echo "
"; $query= "select * from expenses where (date_ between '$from' and '$to') and userID='".$_SESSION['empID']."' and description like'%$anyvalue%' order by vno desc"; //echo $query; $cur= odbc_exec( $conn, $query ); $cnt=1;$total=0; while( odbc_fetch_row( $cur ) ) { if ($cnt==1) echo "
Expenses
S.#VNo.DateDescriptionAmount"; $date_= date("d-m-Y", strtotime(odbc_result( $cur, 'date_' ))); $expID= odbc_result( $cur, 'expID' ); $description= odbc_result( $cur, 'description' ); $amount= round(odbc_result( $cur, 'amount' )); $vno= odbc_result( $cur,'vno'); echo "
$cnt$vno$date_$description$amount" ; $cnt+=1; $total+=$amount; } if($cnt!=1) echo "
Total Expenses$total" ; echo "
"; odbc_close($conn); function getService($typeofService){ if($typeofService=="0") return "Lab Test"; elseif($typeofService=="0") return "Lab Test"; elseif($typeofService=="2") return "Radiology"; elseif($typeofService=="1") return "Cardiology"; elseif($typeofService=="3") return "CT-Scan"; elseif($typeofService=="4") return "X-Ray"; } /* drop VIEW dbo.patientTestsView CREATE VIEW dbo.patientTestsView AS SELECT dbo.patientTests.testID, dbo.patientTests.visitNo, dbo.patientTests.patientID, dbo.patientTests.labNo, dbo.patientTests.date_, dbo.patientTests.doc, dbo.patientTests.testCharges, dbo.patientTests.paymentType, dbo.patientTests.userID, dbo.patientTests.remarks, dbo.testlab.testname, dbo.testlab.testunit, dbo.testlab.testrange, dbo.testlab.show1, dbo.testlab.Charges, dbo.testlab.typeofService, dbo.testlab.range2, dbo.testlab.default_, dbo.testlab.order_, dbo.testlab.subHead, dbo.testlab.mainHead, dbo.patientVisits.doctorID, dbo.patientTab.name AS patientName, dbo.student.stdName AS doctorName, dbo.AccountHeads.headName AS PatientType FROM dbo.patientTests INNER JOIN dbo.patientTab ON dbo.patientTests.patientID = dbo.patientTab.patientID INNER JOIN dbo.testlab ON dbo.patientTests.testID = dbo.testlab.id INNER JOIN dbo.patientVisits ON dbo.patientTests.patientID = dbo.patientVisits.patientID AND dbo.patientTests.visitNo = dbo.patientVisits.visitNo INNER JOIN dbo.student ON dbo.patientVisits.doctorID = dbo.student.empID INNER JOIN dbo.AccountHeads ON dbo.patientTab.patientType = dbo.AccountHeads.ID drop VIEW dbo.servicesView CREATE VIEW dbo.servicesView AS SELECT dbo.services.serviceID, dbo.services.depID, dbo.services.visitNo, dbo.services.patientID, dbo.services.doctorID, dbo.services.date_, dbo.services.charges, dbo.services.paymentType, dbo.services.time_, dbo.services.autoid, dbo.services.userID, dbo.patientTab.name AS patientName, dbo.patientTab.fname, dbo.student.stdName AS doctorName, dbo.patientVisits.doa, dbo.patientVisits.dod, dbo.patientVisits.history, dbo.patientVisits.dieseas, dbo.patientVisits.operation, dbo.patientVisits.findings, dbo.patientVisits.Assistant, dbo.patientVisits.Anesthesiologists, dbo.AccountHeads.headName AS serviceName, student_1.stdName AS AnesthesiologistsName, student_2.stdName AS assistantName, AccountHeads_1.headName AS patientType FROM dbo.services INNER JOIN dbo.patientVisits ON dbo.services.visitNo = dbo.patientVisits.visitNo AND dbo.services.patientID = dbo.patientVisits.patientID INNER JOIN dbo.patientTab ON dbo.patientVisits.patientID = dbo.patientTab.patientID INNER JOIN dbo.student ON dbo.patientVisits.doctorID = dbo.student.empID INNER JOIN dbo.AccountHeads ON dbo.services.serviceID = dbo.AccountHeads.ID INNER JOIN dbo.student student_1 ON dbo.patientVisits.Anesthesiologists = student_1.empID INNER JOIN dbo.student student_2 ON dbo.patientVisits.Assistant = student_2.empID INNER JOIN dbo.AccountHeads AccountHeads_1 ON dbo.patientTab.patientType = AccountHeads_1.ID */ ?>