Generating Invoices and Updating Database Table Automatically - php

I have a possible client with the following tasks:
Teacher
The teacher generates an invoice: at the end of each month the system generates automatically
an invoice with the hours worked by the teacher. The invoice is sent to the school in PDF
format.
and
Student
View teachers information, telephone number, can email teacher.
read/comment the lessons, approves the lessons for billing. if student does not respond lessons
automatically approves within 24 hours.
I understand workings of a web application when user is actually using it, clicking the links and triggering some events.
What I don't know how to do is those parts where something has to be done automatically.
How would you solve this, where things have to be done based on time passed?
I would also appreciate for you to tell me how would you generate .pdf in PHP.

You should implement the functionality to enable the actions described, then create a cron job, set its frequency to the desired and run your task as part of the cron job. As about generating PDF with php, read this.

Related

Create a function to be called at an exact time each time an event has been created to a specific date in the calendar with ionic, php and my sql

I have created a mobile application with ionic that is used to create sporting events among several participating users. When creating an event, the participating users are added and a date must be scheduled for the sporting event. These events are stored in the mysql database with their respective dates.
When it is the day of the event, I must send a notification to all the users who participate in said event.
I already have the functions to create the notifications, I also have a function to list the events, their respective hours and send the notifications to the participants. The only thing I need is to know how I can make this function be called at an exact time each time an event has been created.
What do you suggest to me to do this?
My backend is made with php. The databases are with mysql and firebase. I think that cronjobs do not work since they do not execute a specific date.
Thank you very much for your help.
I found the solution with cronjobs executing them through the database and doing a function that covers the difference in minutes. It works perfectly. Thank you very much

Can I have a user database synced with SugarCRM and use it mostly for emailing?

I work for a company that has a website with about 700,000 users, it would need a tool that would:
List all users
Email users, create templates, send a newsletter
Show products a user has purchased
If you find a user, show which emails have been sent to the user
Create automated tasks, example: send an email to every user that has a product expiring in 30 days
I'm not sure a CRM can do all theses things, I wanted to try a CRM to figure out how close can I get to having a tool that can do all this. I read that SugarCRM is pretty good, and its free so I'm going to try it out.
What I wanted to know is, using the REST or SOAP api of SugarCRM, can I synchronise all my users with the SugarCRM database ? Or for example each time a user is created on our website, insert it in the database.
And then each time we send an email with our website, use SugarCRM instead to send a mail, and store the data. So that we can view which emails have been sent to specific users.
Thank you
Yes you can do all that but it may require some customisation to suit it exactly to your needs. By 'users' I assume you are referring to Customer 'Accounts' as known on the SugarCRM?
Add custom fields to the Contacts module using Studio. The easiest and quickest way to get your data in will be directly to the database.
The standard fields in Sugar Contacts go in the contacts table. Your custom fields will have "_c" appended to their names and be created in the contacts_cstm table. The two tables are related by contacts.id = contacts_cstm.id_c, which is generally a GUID field (but can be any string value if you need it to be).
Then you need to have a process to add new users in your website into sugar. I suggest polling your user db periodically to look for new records and using the SOAP/REST API (good luck though, it's fairly horrible) to insert them into Sugar.
Other than that your use case is pretty much standard Sugar. For automated tasks which happen whenever an email is sent/received or when a new contact is created, you'll want to look at logic hooks, search for logic_hooks.php in the Sugar documentation.

How to send different sms messages to multiple recipients

i have a somewhat challenging task.I have to write an application with PHP and MYSQL
This application is intended to be an sms application that sends sms(text messages) to
various job supervisors,reporting the messages that their subordinates have received.
The application is meant to have a template;
E.g :Message From Postmaster:
Message From Auditor:
etc.
The messages for each subordinate are stored in a table and are retrieved
for each subordinate for a given time period.Each subordinate has a job role which defines the kind of message he receives.
That is:A postman has "pre-defined" people that can send a message.E.g The Postmaster,the Post-office....etc.
An example showing the message format is:
Message From Auditor:Bring Receipts To General Office Sent On Monday
Message From Postmaster:Bring Stamps To Secretariat Sent On Monday
Message From Security: Bring Details For Id Card Sent On Tuesday
Message From Admin:
Message From Supply:
Two subordinates with the same job role can have different messages from the same person.
E.g: Employee x who is a postman might receive "Report to General Office" from the Postmaster,
while Employee y might receive the message "Add New Delivery Routes From Next Week"
The phone numbers for the Supervisors are stored in a table.
A supervisor can supervise multiple people
who have different job roles.
The major point where i will need assistance
is on how to program the application to pick the phone number of the supervisor for each
employee,get the templates for the employee's job role,and populate it with the messages
for the employee and send it to the supervisor.Also, the employees can have more than 1 supervisor.
I know i will need a loop(a "for-each" loop ??)..
I am not also very knowledgeable about the procedure used in sending sms messages to people
from a website with php,
but i know it has to do with arrays.
So in short...i need help on building arrays that will house the phone numbers,message-template
and message template for a particular job role with individual messages
and loop through them
and send them to the recipients.
I will really appreciate any help i can get and i will gladly supply my email to interested parties to further correspondence.THANKS
It sounds like you need to learn some more PHP/MySQL before you'll be able to tackle this... The major part you need help with is straightforward, just some tables and queries... For the SMS, Google for "PHP SMS API" and you will find scads of options.
I am not also very knowledgeable about the procedure used in sending
sms messages to people from a website with php, but i know it has to
do with arrays
No this is not true. Arrays may be used to implement portions of the code used in doing so, but that statement is like saying building a website w/ PHP has to do w/ arrays... You might try the php-general mailing list for more help getting off the ground in your PHP coding, but there really isn't a specific question here.

Email notifications for when events align with location. How?

I am looking at building a webapp in php/mysql that people can log into, and sign up to receive email notifications when a certain event is at their chosen location, e.g a jack johnson concert in new zealand, receivng a notification when he comes to that location to perform. I am guessing that there is some online concert database that apps like shazam use that i could intergrate with.
Any help on building this sort of app would be appreciated, most importantly the notification system and how that integrates with another concert database and the users details .
I have a basic knowledge of php/mysql, I'm guessing I should use a framewok for this, if anyone knows one useful for this task that would be appreciated too.
Thankyou!
Always check ProgrammableWeb when looking fr APIs. I found the Gruvr API:
Gruvr offers tons of geocoded concert data, with about 170K upcoming
shows for 45K bands currently listed. You can ask for upcoming
concerts by location or by band. The results can be returned as
geoRSS, KML, or dynamic map links.
For triggering events, checkout momentapp, which lets you schedule delayed HTTP requests.
Maybe you could start from there. What you could do is when somebody signs up with their location, check Gruvr if there are any upcoming concerts in their area, then schedule a request with momentapp which will trigger your email notification script at a specified time before the event to alert the user.
You can also use CRON as an alternative to using a 3rd-party service like momentapp.
I think your question can be broken down into more questions.

Daily digest emails on user registration

I'm writing a simple signup page for a small-scale text message service - sort of like a mailing list, but instead of emails, I send text messages to those who sign up with me.
Since its small-scale and I don't want it to get too complicated my current idea is to add users to a mySQL database and then manually add the new users to the texting list (which is managed separate unfortunately).
I was wondering if there's a way to generate a daily email digest of new registrations, so that it would just email me all the new registrations that happened today instead of an email every time someone signs up. Is this possible? Perhaps a CRONTAB?
Sure. Store the signup date in your table. Write a script which retrieves the list of people that signed up today and set up crontab to run that script at 11:59PM each night.
SELECT * FROM registrations WHERE signup_date = CURDATE()

Categories