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Yƣ&悁OƟItut,ˁk`)`)Lwsc.Righv/w=TF ;61+[)=BF< RBF< RNg]k|c?Bd^qBSeo]JECV +K%{^TV-̬e՟v1hjb3]t[WO>%³݇ZY(}|`9okxF$C>L׹tȘpl^d⢞ǿY>Vp<J t=8dǥw!90וZytLxX;&]m Hwo\_$V:a c5~e|hሑ<-hgiz( be3 mg=[gTHO=;ԁ@F3ksL 7=^`8)/B#B1׵ I䨼u2&;q[Tx?_x (w1),QQH!@MgP0i&$//echo "
"; //echo "
From:TO : "; //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 //reg Charges $query= "select doctorID,count(*) as cases,sum(regCharges) as amount from patientTab where (date_ between '$from' and '$to') group by doctorID"; //$query="insert into patientTab (age,ageStatus,regCharges,date_,dob,gender,remarks,patientType,doctorID,patientID,name,fname,address,contacts,nic,email)"; //echo $query; $cur= odbc_exec( $conn, $query ); $cnt=1;$total=0; while( odbc_fetch_row( $cur ) ) { if ($cnt==1){ echo "
Doctor Patient Summary ($from - $to)
S.#DoctorCasesAmount"; } $stdName= getName($conn, "select stdName from student where ID=".odbc_result($cur,'doctorID')); echo "
$cnt$stdName".odbc_result( $cur, 'cases' )."".odbc_result($cur,'amount') ; $total+=odbc_result( $cur,'amount'); $cnt+=1; } if($cnt!=1) echo "
Total$total" ; echo "
"; //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"; elseif($typeofService=="5") return "MRI"; else return "Un-Defined"; } /* 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 */ ?>