Forum Discussion

team280's avatar
team280
Copper Contributor
Oct 25, 2024

Patient Tracker and Package Tracker

Hi,

I have two excel sheets one in which patient attendance is tracked with which therapist has been attended. Another sheet that says the type of package that the patients has bought. 

 

Every day I need to calculate the revenue by each Therapist. I have attached both the sheets, to show the type of data that is being generated from the system. 

 

From the software that we use we can generate the patient attendance tracker in excel (csv format).

I would like to know can MS Access help me. The attendance sheet needs to be generated at the end of the day every day and needs to uploaded to MS Access, how will I be able to do that

 

Patient Attendance Tracker 

Patient NamePatient IDTherapistDepartmentDate
Shyam Hani153RyaanOccupational Therapy02/10/2024
Shyam Hani153RyaanOccupational Therapy04/09/2024
Shyam Hani153RyaanOccupational Therapy06/09/2024
Shyam Hani153SanjuSpeech Therapy02/10/2024
Shyam Hani153SanjuSpeech Therapy04/09/2024
Shyam Hani153SanjuSpeech Therapy05/10/2024
Shyam Hani153SanjuSpeech Therapy06/09/2024
Shyam Hani153SanjuSpeech Therapy07/09/2024
Meera Hasan152SanjuSpeech Therapy09/10/2024
Meera Hasan152SanjuSpeech Therapy09/10/2024
Meera Hasan152SanjuSpeech Therapy10/08/2024
Meera Hasan152SanjuSpeech Therapy11/09/2024
Meera Hasan152SanjuSpeech Therapy11/09/2024
Meera Hasan152SanjuSpeech Therapy11/10/2024
Meera Hasan152SanjuSpeech Therapy11/10/2024
Meera Hasan152SanjuSpeech Therapy12/10/2024
Dev Mani112SanjuOccupational Therapy01/10/2024
Dev Mani112SanjuOccupational Therapy02/10/2024
Dev Mani112SanjuOccupational Therapy04/10/2024
Dev Mani112SanjuOccupational Therapy08/10/2024
Dev Mani112SanjuOccupational Therapy09/10/2024
Dev Mani112SanjuOccupational Therapy10/09/2024
Dev Mani112SanjuOccupational Therapy10/10/2024
Dev Mani112RyaanOccupational Therapy11/09/2024
Dev Mani112RyaanOccupational Therapy11/10/2024
Dev Mani112RyaanOccupational Therapy12/09/2024
Dev Mani112RyaanOccupational Therapy01/10/2024
Dev Mani112RyaanOccupational Therapy04/10/2024
Dev Mani112RyaanOccupational Therapy08/10/2024
Dev Mani112RyaanOccupational Therapy10/10/2024

 

 

Patient Price Tracker

 

Patient NameTherapistPatient IDPackage FromPackage ToPackage PricePackage
Shyam HaniSanju153Wednesday, 2 October 2024Wednesday, 4 September 2024100Speech Therapy
Shyam HaniRyaan153Wednesday, 2 October 2024 0Occupational Therapy
Meera HasanSanju152Wednesday, 9 October 2024Saturday, 12 October 2024200Occupational Therapy
Dev ManiSanju112Tuesday, 1 October 2024Tuesday, 8 October 2024300Occupational Therapy
Dev ManiRyaan112Saturday, 27 July 2024Tuesday, 27 August 2024400Occupational Therapy

8 Replies

  • Ken_Sheridan's avatar
    Ken_Sheridan
    Copper Contributor

    You don't need to import your Excel files into tables in Access.  You can link to them, which will mean the database will always reflect updates of the data in the Excel files.  You can then return the pro rata income per therapist per day with the following query:

     

    SELECT [Patient Attendance Tracker].[Date], [Patient Attendance Tracker].Therapist,

    SUM([Package Price]/((Nz([Package to],DATE())-[Package From])+1)) AS [Pro rata daily income]

    FROM [Patient Attendance Tracker] LEFT JOIN [Patient Price Tracker]

        ON ([Patient Attendance Tracker].[Date]>= [Patient Price Tracker].[Package From])

        AND ([Patient Attendance Tracker].[Date] < [Patient Price Tracker].[Package To]+1 )

        AND ([Patient Attendance Tracker].Department = [Patient Price Tracker].Package)

        AND ([Patient Attendance Tracker].Therapist = [Patient Price Tracker].Therapist)

    GROUP BY [Patient Attendance Tracker].[Date], [Patient Attendance Tracker].Therapist;

     

    This will return the pro rata income per therapist per date for those dates where a patient has an attendance date within a range specified for the therapist in a row in [Patient Price Tracker].  With the data in the two Excel files you posted this is not always the case, so a therapist's name will be returned for a date, but with a Null at the [Pro rata daily income] column position.  Also, in one case the range has a start date later than its end date.

     

    If you wish to return rows for all dates, in addition to those returned by the above query, then you'd need to include an auxiliary Calendar table in the query as follows:

     

    SELECT Calendar.calDate, [Patient Attendance Tracker].Therapist,

    SUM([Package Price]/((NZ([Package to],DATE())-[Package From])+1)) AS [Pro rata daily income]

    FROM Calendar LEFT JOIN ([Patient Attendance Tracker] LEFT JOIN [Patient Price Tracker]

        ON ([Patient Attendance Tracker].[Date]>= [Patient Price Tracker].[Package From])

        AND ([Patient Attendance Tracker].[Date]< [Patient Price Tracker].[Package To]+1 )

        AND ([Patient Attendance Tracker].Department = [Patient Price Tracker].Package)

        AND ([Patient Attendance Tracker].Therapist = [Patient Price Tracker].Therapist))

        ON Calendar.calDate = [Patient Attendance Tracker].[Date]

    GROUP BY Calendar.calDate, [Patient Attendance Tracker].Therapist;

     

    For means of generating auxiliary calendar tables take a look at Calenadr.zip in my public databases folder at:

     

    https://onedrive.live.com/?id=44CC60D7FEA42912%21169&cid=44CC60D7FEA42912

     

    This little demo file you'd use the Daily Calendar option, and possibly exclude weekends and/or public holidays, for which the demo includes provision.

  • peiyezhu's avatar
    peiyezhu
    Bronze Contributor

    team280 

     

    sql:

    select * from Sheet2;

    select * from Sheet1;

    select Sheet2.f03,sum(f06) from Sheet2 join Sheet1 on Sheet2.f02=Sheet1.f03 and Sheet2.f03=Sheet1.f02 group by Sheet2.f03;

     

     

     

    f01f02f03f04f05  
    Shyam Hani153RyaanOccupational Therapy02/10/2024  
    Shyam Hani153RyaanOccupational Therapy04/09/2024  
    Shyam Hani153RyaanOccupational Therapy06/09/2024  
    Shyam Hani153SanjuSpeech Therapy02/10/2024  
    Shyam Hani153SanjuSpeech Therapy04/09/2024  
    Shyam Hani153SanjuSpeech Therapy05/10/2024  
    Shyam Hani153SanjuSpeech Therapy06/09/2024  
    Shyam Hani153SanjuSpeech Therapy07/09/2024  
    Meera Hasan152SanjuSpeech Therapy09/10/2024  
    Meera Hasan152SanjuSpeech Therapy09/10/2024  
    Meera Hasan152SanjuSpeech Therapy10/08/2024  
    Meera Hasan152SanjuSpeech Therapy11/09/2024  
    Meera Hasan152SanjuSpeech Therapy11/09/2024  
    Meera Hasan152SanjuSpeech Therapy11/10/2024  
    Meera Hasan152SanjuSpeech Therapy11/10/2024  
    Meera Hasan152SanjuSpeech Therapy12/10/2024  
    Dev Mani112SanjuOccupational Therapy01/10/2024  
    Dev Mani112SanjuOccupational Therapy02/10/2024  
    Dev Mani112SanjuOccupational Therapy04/10/2024  
    Dev Mani112SanjuOccupational Therapy08/10/2024  
    Dev Mani112SanjuOccupational Therapy09/10/2024  
    Dev Mani112SanjuOccupational Therapy10/09/2024  
    Dev Mani112SanjuOccupational Therapy10/10/2024  
    Dev Mani112RyaanOccupational Therapy11/09/2024  
    Dev Mani112RyaanOccupational Therapy11/10/2024  
    Dev Mani112RyaanOccupational Therapy12/09/2024  
    Dev Mani112RyaanOccupational Therapy01/10/2024  
    Dev Mani112RyaanOccupational Therapy04/10/2024  
    Dev Mani112RyaanOccupational Therapy08/10/2024  
    Dev Mani112RyaanOccupational Therapy10/10/2024  
    f01f02f03f04f05f06f07
    Shyam HaniSanju153Wednesday, 2 October 2024Wednesday, 4 September 2024100Speech Therapy
    Shyam HaniRyaan153Wednesday, 2 October 2024  Occupational Therapy
    Meera HasanSanju152Wednesday, 9 October 2024Saturday, 12 October 2024200Occupational Therapy
    Dev ManiSanju112Tuesday, 1 October 2024Tuesday, 8 October 2024300Occupational Therapy
    Dev ManiRyaan112Saturday, 27 July 2024Tuesday, 27 August 2024400Occupational Therapy
    f03sum(f06)     
    Ryaan2800     
    Sanju4200     
  • peiyezhu's avatar
    peiyezhu
    Bronze Contributor
    Please show your expected result based on these two sheets from the OP.
  • arnel_gp's avatar
    arnel_gp
    Steel Contributor

    team280 here is a video on how to upload your csv to a database.

    import csv .

    i also attached a ms db. open it and upload the csv to Patient Attendance Tracker table.

    after you successfully uploaded the csv, you open Form1 for preparation to print your report.

     

  • arnel_gp's avatar
    arnel_gp
    Steel Contributor

    team280 , can you upload the real csv file.

    it is hard to copy and paste the one you show in excel.

Resources