how to show reminder notification in laravel5 - laravel-5

I have a reminder table. how I can show reminder at a specified time.
This is my table
id | due_date | due_time | notes | created_by
------------------------------------------------------
1 |2019-02-27| 10:00:00 | Hai, testing | Rahul
I want to show the content from this table at the specified time (due_time)

Related

AWS QuickSight filtering based on result of a query or other dataset

I want to create an analysis table in AWS Quicksight that shows the quantity sold in a given month and it's subsequent month based on users who made a purchase on the given month.
Let's say I have a dataset called user_orders with the following data:
+---------+----------+------------+
| user_id | quantity | order_date |
+---------+----------+------------+
| 1 | 2 | 2020-04-01 |
+---------+----------+------------+
| 1 | 3 | 2020-04-02 |
+---------+----------+------------+
| 1 | 1 | 2020-05-23 |
+---------+----------+------------+
| 1 | 2 | 2020-06-02 |
+---------+----------+------------+
| 2 | 1 | 2020-05-03 |
+---------+----------+------------+
| 2 | 1 | 2020-05-04 |
+---------+----------+------------+
| 3 | 2 | 2020-04-07 |
+---------+----------+------------+
| 3 | 1 | 2020-04-10 |
+---------+----------+------------+
| 3 | 1 | 2020-06-23 |
+---------+----------+------------+
For example, using the table above I want to be able to show how many quantities sold in April, May, June, and so on (max 12 months) by users who made a purchase in April.
The resulting table should look like this:
+-----------+----------+
| | quantity |
+-----------+----------+
| 04-2020 | 8 |
+-----------+----------+
| 05-2020 | 1 |
+-----------+----------+
| 06-2020 | 3 |
+-----------+----------+
8 sold in April because user_id 1 made 5 purchase and user_id 3 made 3 purchase while user_id 2 did not make any purchase.
There is only 1 item sold in May because only user_id 1 made the purchase in May, but also made a purchase in April. user_id 2 also made a purchase in May but didn't in April so it's not counted.
I can make the table above using PHP and MySQL fairly easily using the following code:
# first get all the user ids who made a purchase in April
$user_ids = sql_query("SELECT DISTINCT user_id FROM user_orders WHERE order_date BETWEEN '2020-04-01' AND '2020-04-30'");
# get the quantity sold for each month by users who made a purchase in April
$purchases = sql_query("SELECT MONTH(order_date), SUM(quantity) FROM user_orders WHERE user_id IN ({$user_ids}) AND order_date BETWEEN '2020-04-01' AND '2021-03-31' GROUP BY MONTH(order_date);")
(Obviously, April is just an example, I'd like to be able to change the starting month dynamically using QuickSight control)
As my above example shown, it requires two queries to perform this analysis. First, is to get the user_ids of the users, and the next is to actually get the quantity sold by the users.
I have been trying to achieve this using Quicksight for the last 3 days but hasn't found any way yet.
I hope someone can point me in the right direction.
Thank you!
You can achieve this by creating a calculated field like this and filtering on it
distinctCountOver(ifelse(truncDate('MM', {order_Date}) = parseDate('2020-04-01'), 1, NULL), [{user_id}], PRE_AGG)
(ofcourse, you can change the parseDate portion to be your date parameter)
Now, lets say the name of the above calculated field is SpecificMonthUser. You can add a filter sum(SpecificMonthUser) != 0.
And then create a pivot table visualization with OrderDate, user id in the rows and sum(quantity) in the values. You should get the desired result.

Power BI chart with slicers and two bar when the second bar have modificated filter

I have small problem with chart in PowerBi.
I created 4 tables and set up connections between them:
Year
-----------
Id | Value
-----------
Y_19| 2019
Y_20| 2020
Y_21| 2021
Month
-----------
Id | Value
-----------
M_Jan | January
M_Feb | February
M_Mar | March
M_Apr | April
Tax
--------------------------
Id | Value | YearId
--------------------------
Tax_Y_19 | 0.9 | Y_19
Tax_Y_20 | 0.1 | Y_20
Tax_Y_21 | 0.4 | Y_21
Amount
-------------------------------
Id | MonthId | YearId | Value
A_01 | M_Jan | Y_19 | 10000
A_02 | M_Feb | Y_19 | 2000
A_03 | M_Mar | Y_19 | 4000
A_04 | M_Jan | Y_20 | 5000
A_05 | M_Feb | Y_20 | 70000
A_06 | M_Mar | Y_20 | 10000
Then I created slicers where I can choose year (connected column Year[Value]) and created chart with Amount[Value] (y axis), Month[Value] (x axis).
Everything works fine for me, thanks to the relationship of the tables, everything is filtered by year.
But I would like to show the values ​​multiplied by tax if I can somehow make the chart [Tax] * [Amount] - both tables are already filtered by the slicers and when I get it,
I would like to show the bar for Year-1 data on this chart, but I already have a global filter by slicers for a specific year, how could I do it.
I tried to use measure in which I get data from a slicers (Year) using selectedvalue ​​and change the filter on the tables (Tax and Amount) with keepfilter, but measure returns an error that I can't return the table
Your question isn't entirely clear but if your Year table has a relationship with Tax and Amount, then I'm guessing you're after something like this as a measure:
TaxedAmount =
SUMX ( Year, RELATED ( Tax[Value] ) * CALCULATE ( SUM ( Amount[Value] ) ) )

How to count calculate the remaining time years using Carbon Laravel 5.8

I have a table name user . in user have filed colomn 'date' .
in this colomn field 'date' have data like this
users table
id | name | email | date |
1 | jhon | a#gmail.com | 2021-06-07 |
2 | phil | b#gmail.com | 2020-06-07 |
i want to showed data where 'date' is year is less than 1 year from now.
from this table just show :
2 | phil | b#gmail.com | 2020-06-07 |
because this date is less than 1 year . i am using laravel .
You can use this query to get users which their date field are less than one year from now:
User::query()->where('date', '<', Carbon::now()->subYear())->get();
You want to show users who have "date" that is less than a year from now. You can write a query very easily for that.
$users = User::whereBetween('date', [now(), now()->addYear()])->get();
This will filter down the results who have "date" values between now and a year from now. now is a helper function that returns a carbon date instance.

SSRS (Report Builder) Min Value and Max Value from Same Dataset

I am attempting to extract data from a database that has an error in it. I can't resolve the error (it's a "design feature"), so i have to try to query around it. Here's how it is stored.
Record ID | Create Date | Update Date | Record Status
123 | 05/01/2018 | 05/01/2018 | Active
123 | 05/08/2018 | 05/08/2018 | Active
123 | 05/15/2018 | 05/15/2018 | Closed
123 | 05/22/2018 | 05/22/2018 | Closed
456 | 06/02/2018 | 06/02/2018 | Pending
456 | 06/09/2018 | 06/09/2018 | Active
456 | 06/16/2018 | 06/16/2018 | Active
456 | 06/23/2018 | 06/23/2018 | Suspended
And so on. As you can see, the Create Date and Update Date values match on each row. The Create Date value is supposed to be the date the Record ID was initially created, but it's actually being captured as the date the Record ID update was created.
What I need is a report that brings me a single row per Record ID that shows me the minimum Create Date and the maximum Update Date, so that the result looks something like this:
Record ID | Create Date | Update Date | Record Status
123 | 05/01/2018 | 05/22/2018 | Closed
456 | 06/02/2018 | 06/23/2018 | Suspended
I've tried using the MIN and MAX aggregate functions in the Query Designer, and that works just fine until I add any other field that may change through the life of the record. I get this:
Record ID | Create Date | Update Date | Record Status
123 | 05/01/2018 | 05/08/2018 | Active
123 | 05/15/2018 | 05/22/2018 | Closed
456 | 06/02/2018 | 06/02/2018 | Pending
456 | 06/09/2018 | 06/16/2018 | Active
456 | 06/23/2018 | 06/23/2018 | Suspended
I'm relatively new to Report Builder, though I think I'm picking up its concepts quickly. What am I missing here?
Edited to add that when I use the Query Designer, the query text looks like this:
SELECT
DB.RECORD.RECORD_ID
,DB.RECORD.RECORD_STATUS_CODE
,MAX(DB.RECORD.RECORD_CREATED_DATE) AS Max_RECORD_CREATED_DATE
,MIN(DB.RECORD.RECORD_UPDATED_DATE) AS Min_RECORD_UPDATED_DATE
FROM
DB.RECORD
GROUP BY
DB.RECORD.RECORD_ID
,DB.RECORD.RECORD_STATUS_CODE
There are more elegant ways to do this using CTEs but this is a simple solution.
First I replicated your data sample and stuffed in into a table variable #t. Then all we do is group by recordid, getting the min create date and max update date (ignoring the status for now). We join to this subquery back to your original table, joining on recordid and update date, this will give us the last record for the record id and get the status from there.
DECLARE #t TABLE ([Record ID] int, [Create Date] date, [Update Date] date, [Record Status] varchar(20))
INSERT INTO #t VALUES
(123, '2018-05-01', '2018-05-01', 'Active'),
(123, '2018-05-08', '2018-05-08', 'Active'),
(123, '2018-05-15', '2018-05-15', 'Closed'),
(123, '2018-05-22', '2018-05-22', 'Closed'),
(456, '2018-06-02', '2018-06-02', 'Pending'),
(456, '2018-06-09', '2018-06-09', 'Active'),
(456, '2018-06-16', '2018-06-16', 'Active'),
(456, '2018-06-23', '2018-06-23', 'Suspended')
SELECT
g.[Record ID], g.[Create Date], g.[Update Date], t.[Record Status]
FROM
(
SELECT [Record ID], MIN([Create Date]) AS [Create Date], MAX([Update Date]) AS [Update Date]
FROM #t
GROUP BY [Record ID]
) g
JOIN #t t ON g.[Record ID] = t.[Record ID] and g.[Update Date] = t.[Update Date]
ORDER BY [Record ID]
Here's link to a SQL Fiddle that shows the results. The only difference with this version is the table name.
http://sqlfiddle.com/#!18/0bb22/1/0
UPDATE Based on your dataset query
This may not be 100% as I don;t have all your data to test but you probably just need the following.
SELECT
g.RECORD_ID, g.RECORD_CREATED_DATE, g.lastUpdateDate, t.RECORD_STATUS_CODE
FROM
(
SELECT RECORD_ID, MIN(RECORD_CREATED_DATE) AS RECORD_CREATED_DATE, MAX(RECORD_UPDATED_DATE) AS lastUpdateDate
FROM DB.RECORD
GROUP BY RECORD_ID
) g
JOIN DB.RECORD t ON g.RECORD_ID = t.RECORD_ID and g.lastUpdateDate = t.RECORD_UPDATED_DATE
ORDER BY RECORD_ID

Calculated field that shows the result of a query

In MS Access (2013 if it matters), is it possible to have a calculate field in a table that displays the result of a query on another table?
For example, let's say my tables are (stars indicate primary key) -
Table Customers
*Customer ID | First name | Last name
------------------------------------
1 | John | Doe
2 | Joe | Smith
Table Purchases
*Purchase ID |Customer ID | Product | Last name | Notes
----------------------------------------------------------
25 |1 | Chair | Doe |
45 |1 | Table | Doe |
46 |2 | Table | Smith |
Every time a customer buys something, I add a a new row to Purchases. However, when I type in their Customer ID, I would like Last name to be filled in automatically.

Resources