Although I would really protect this in the application code, here is a solution that uses a small integer utility table. Instead, you can use a calendar table or build a sequence of integers on the fly ...
DROP TABLE IF EXISTS my_table;
CREATE TABLE my_table
(Perid SERIAL PRIMARY KEY
,DtFrom DATE NOT NULL
,DtTo DATE NOT NULL
,Amount INT NOT NULL
);
INSERT INTO my_table VALUES
(1,'2018-01-01','2018-01-10',100),
(2,'2018-01-03','2018-01-08',10),
(3,'2018-01-05','2018-01-12',1);
SELECT * FROM ints;
+
| i |
+
| 0 |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
+
SELECT dtfrom + INTERVAL y.i DAY dt
, SUM(x.amount) total
FROM my_table x
JOIN ints y
WHERE dtfrom + INTERVAL y.i DAY <= dtto
GROUP
BY dt;
+
| dt | total |
+
| 2018-01-01 | 100 |
| 2018-01-02 | 100 |
| 2018-01-03 | 110 |
| 2018-01-04 | 110 |
| 2018-01-05 | 111 |
| 2018-01-06 | 111 |
| 2018-01-07 | 111 |
| 2018-01-08 | 111 |
| 2018-01-09 | 101 |
| 2018-01-10 | 101 |
| 2018-01-11 | 1 |
| 2018-01-12 | 1 |
+
If the gap between dtfrom and dtto can be more than 10 days, you can expand the solution along these lines ...
SELECT dtfrom + INTERVAL i2.i*10 + i1.i DAY dt
, SUM(x.amount) total
FROM my_table x
JOIN ints i1
JOIN ints i2
WHERE dtfrom + INTERVAL i2.i*10 + i1.i DAY <= dtto
GROUP
BY dt;