Send Email and automatically save new value into database

Hi,
I think this is a very unique problem, hope that anyone could help me. I tried to send email notification using pl/sql block (check_delay) as below. Please focus to this section first, from the pl/sql:
Problem 1
--> if emp_rec.OVERDUE_AMOUNT_PAID is not null then
dbms_output.put_line('emp_rec.payment_progress_id ' || emp_rec.payment_progress_id || crlf);
select c.PAYMENT_PROGRESS into payment_progress from credit_sales c where c.PAYMENT_PROGRESS_ID = emp_rec.payment_progress_id;
payment_ratio := (payment_progress/emp_rec.invoice_amount);
dbms_output.put_line('count ratio progress payment to invoice amount ' || payment_ratio || crlf);
dbms_output.put_line('payment progress ' || payment_progress || crlf);
Here, sql checks whether overdue amount is being paid in progress from payment_overdue table..then creates variables for ratio(payment_ratio) and progress payment amount(payment_progress). After that if payment_ratio < 0.1 it must sends email notification to customer_id and customer_representative_id. However, it does NOT send notification to
customer_id! How do I amend the code so that customer_id will get the notification too?
Problem 2
In problem 2, please focus to :
-->if emp_rec.OVERDUE_AMOUNT_PAID is null then
If customer does not pay any amount, sql will first checks whether delay between scheduled payment date and current system is more than 3 days..
dbms_output.put_line('count days delay ' || round(sysdate - to_date(emp_rec.scheduled_payment_date)) || crlf || crlf);
if round(sysdate - to_date(emp_rec.scheduled_payment_date)) >3 then
After that, sql will counts how many times customer delays. If first time, the notification will count notification as number 1..and update remark column with the message and count value as below..
select count(a.payment_overdue_id) as count into count from payment_overdue a where a.customer_id = emp_rec.CUSTOMER_ID and a.invoice_no = emp_rec.invoice_no;
     dbms_output.put_line('update remark : '||emp_rec.remark);
update PAYMENT_OVERDUE set remark='Reminder notice no '||count where payment_overdue_id=emp_rec.payment_overdue_id;
Finally, notification to be sent to customer with the message format as below..
email_to:=emp_rec.customer_id||default_email;
select b.INVOICE_NO into invoice_no from INVOICE b where b.INVOICE_ID = emp_rec.INVOICE_ID;
subj:='Reminder to make payment for Invoice No '||invoice_no;
mesg:='Kindly make payment for your amount outstanding as per Invoice No '||invoice_no||'. Reminder notice no '||count;
dbms_output.put_line('Sending email to ' || email_to || ' subject: ' || subj);
e_mail_message(email_to,email_to,subj,mesg);
Unfortunately, no email notification being sent to customer with this message format.. Please help me to make customer to receive the notification with this format.
Kindly, thank you so much for you guys to help me solve these two problems, Problem 1 and Problem 2....
Thank you.
CREATE OR REPLACE PROCEDURE TEST.check_delay AS
NO binary_float;
CURSOR emp_cur is
select * from PAYMENT_OVERDUE where FLAG=3 and STATUS='OUTSTANDING';
emp_rec emp_cur%rowtype;
email_to varchar2(200);
default_email varchar2(200);
mesg varchar2(4000);
invoice_no varchar2(100);
subj varchar2(4000);
payment_progress binary_float;
payment_ratio binary_float;
count number;
crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
BEGIN
default_email:='@test.com';
FOR emp_rec in emp_cur
LOOP
if emp_rec.OVERDUE_AMOUNT_PAID is null then
dbms_output.put_line('count days delay ' || round(sysdate - to_date(emp_rec.scheduled_payment_date)) || crlf || crlf);
if round(sysdate - to_date(emp_rec.scheduled_payment_date)) >3 then
     select count(a.payment_overdue_id) as count into count from payment_overdue a where a.customer_id = emp_rec.CUSTOMER_ID and a.invoice_no = emp_rec.invoice_no;
     dbms_output.put_line('update remark : '||emp_rec.remark);
update PAYMENT_OVERDUE set remark='Reminder notice no '||count where payment_overdue_id=emp_rec.payment_overdue_id;
     email_to:=emp_rec.customer_id||default_email;
select b.INVOICE_NO into invoice_no from INVOICE b where b.INVOICE_ID = emp_rec.INVOICE_ID;
subj:='Reminder to make payment for Invoice No '||invoice_no;
mesg:='Kindly make payment for your amount outstanding as per Invoice No '||invoice_no||'. Reminder notive no '||count;
dbms_output.put_line('Sending email to ' || email_to || ' subject: ' || subj);
e_mail_message(email_to,email_to,subj,mesg);
end if;
end if;
if emp_rec.OVERDUE_AMOUNT_PAID is not null then
dbms_output.put_line('emp_rec.payment_progress_id ' || emp_rec.payment_progress_id || crlf);
select c.PAYMENT_PROGRESS into payment_progress from credit_sales c where c.PAYMENT_PROGRESS_ID = emp_rec.payment_progress_id;
payment_ratio := (payment_progress/emp_rec.invoice_amount);
dbms_output.put_line('count ratio progress payment to invoice amount ' || payment_ratio || crlf);
dbms_output.put_line('payment progress ' || payment_progress || crlf);
if payment_ratio < 0.1 then
email_to:=emp_rec.customer_id||default_email;
select b.INVOICE_NO into invoice_no from INVOICE b where b.INVOICE_ID = emp_rec.INVOICE_ID;
subj:='Reminder to settle outstanding amount for Invoice No '||invoice_no;
mesg:='Kindly settle your outstanding payment as per Invoice No '||invoice_no;
dbms_output.put_line('Sending email to ' || email_to || ' subject: ' || subj);
e_mail_message(email_to,email_to,subj,mesg);
email_to:=emp_rec.customer_representative_id||default_email;
subj:='Reminder to settle outstanding amount for Invoice No '||invoice_no;
mesg:='Kindly settle your outstanding payment as per Invoice No '||invoice_no;
dbms_output.put_line('Sending email to ' || email_to || ' subject: ' || subj);
e_mail_message(email_to,email_to,subj,mesg);
end if;
if (payment_ratio < 0.5 && payment_ratio > 0.1) then
select b.INVOICE_NO into invoice_no from INVOICE b where b.INVOICE_ID = emp_rec.INVOICE_ID;
     email_to:=emp_rec.customer_id||default_email;
subj:='Reminder to settle outstanding amount for Invoice No '||invoice_no;
mesg:='Kindly settle your outstanding payment as per Invoice No '||invoice_no;
dbms_output.put_line('Sending email to ' || email_to || ' subject: ' || subj);
e_mail_message(email_to,email_to,subj,mesg);
end if;
end if;
END LOOP;
END;
/

Hi BownieCross;
If you are using a local database file in your project the following may be the cause.
From Microsoft Documentation:
Issue:
"Every time I test my application and modify data, my changes are gone the next time I run my application."
Explanation:
The value of the Copy
to Output Directory property is Copy
if newer or Copy
always. The database in your output folder (the database that’s being modified when you test your application) is overwritten every
time that you build your project. For more information, see How
to: Manage Local Data Files in Your Project.
Fernando (MCSD)
If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects
and unknown namespaces.

Similar Messages

  • Entity Framework doesn't save new record into database

    Hy,
    I have problem with saving new record into database using Entity Framework.
    When I run program, everything seems normal, without errors . Program shows existing, manually added records into the database, and new one too. But new one isn't save into database after running program.
    I've got no idea where's problem. There is code for add new record, show existing.
    Thanks for help!!
    // add new record
    using (var db=new DatabaseEntitiesContext())
    var person = new Table()
    First_Name = "New_FName",
    Second_Name = "New_SName",
    PIN = "4569"
    db.Tables.Add(person);
    db.SaveChanges();
    //show all records
    using (var db=new DatabaseEntitiesContext())
    var selected = from x in db.Tables
    select x;
    foreach (var table in selected)
    Console.WriteLine("{0}{1}{2}",table.First_Name,table.Second_Name,table.PIN);

    Hi BownieCross;
    If you are using a local database file in your project the following may be the cause.
    From Microsoft Documentation:
    Issue:
    "Every time I test my application and modify data, my changes are gone the next time I run my application."
    Explanation:
    The value of the Copy
    to Output Directory property is Copy
    if newer or Copy
    always. The database in your output folder (the database that’s being modified when you test your application) is overwritten every
    time that you build your project. For more information, see How
    to: Manage Local Data Files in Your Project.
    Fernando (MCSD)
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects
    and unknown namespaces.

  • I am working in Numbers and can't seem to change the generic value assigned to the legend.  Any advice on how to select the legend and save new values?

    I am working in Numbers and can't seem to change the generic value assigned to the legend.  Any advice on how to select the legend and save new values?

    Ntenich,
    If your table has a Header and your Legend text is in the header, it will be picked up by the table.
    Jerry

  • I have totallymessed up outlook on my ipad, attempted to change password, and then couldn't send email and now can't access at all.  can i reload "clean" new version and start all over?

    i have totallymessed up outlook on my ipad, attempted to change password, and then couldn't send email and now can't access at all.  can i reload "clean" new version and start all over?

    Settings>Mail, contacts, calendars>Your email account name>Delete Account. A window will popu after you select your email account in the settings and there is a large red Delete Button at the bottom of the window.
    Settings>Mail, contacts, calendars>Add account. Tap on Add account and start entering your email account details again. If your email account doesn't fit one the per installed accounts in there, tap on Other - and add your account in there.
    I would restart the iPad after you delete the email account, just to be starting "fresh" again.
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button

  • When i try to delete messages from my email in box, they turn into a "No Sender" email and I cannot delete these.....

    when i try to delete messages from my email in box, they turn into a "No Sender" email and I cannot delete these.....

    Hello there, Paso Kid.
    The following Knowledge Base articles provide some assistance with locating content in your iTunes Library:
    iTunes: Finding lost media and downloads
    http://support.apple.com/kb/TS1408
    and
    Where are my iTunes files located?
    http://support.apple.com/kb/HT1391
    If you have already reviewed those steps and still cannot find the songs you purchased from iTunes, delete the songs and download them again using the information in this article:
    iTunes 11 for Windows: Download previous purchases from the iTunes Store
    http://support.apple.com/kb/PH12491
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • I can no longer send emails and my drafts folder no longer functions. How do I fix them?

    I am using Windows XP. I have Mozilla Firefox 3.6. My Gmail account no longer can send emails and my Drafts folder is inoperable. I can see, save, discard, or edit anything in Drafts. This is only with my home pc. Any other computer (library, work..) does work. How do I fix this?
    == This happened ==
    Every time Firefox opened
    == about a momth ago

    Please read and begin using Can receive email, but not send email. I had a similar issue with Comcast mail (could receive by not send) and found my answer in this letter. For me it took resetting the outgoing mail and telling the system to use a password when sending outgoing mail. If you need help with that please advise and I'll tell you where to look. 

  • Combo box in JavaScript and store the combo box values into database

    i am a developer, i have a task ie.. i have combo box in JavaScript and i have to store the combo box values into database through JavaServerPage..
    i please every one to have a look on this and please reply soon....

    dear sir,
    your suggestions are really greater the god.............
    i have applied as you said , now i am the page as updated and also i nform you that its multi select ....
    i will show the codings , then u will get a clear identification
    <script language= "JavaScript">
    <!--
    function one2two() {
        m1len = m1.length ;
        for ( i=0; i<m1len ; i++){
            if (m1.options.selected == true ) {
    m2len = m2.length;
    m2.options[m2len]= new Option(m1.options[i].text);
    for ( i = (m1len -1); i>=0; i--){
    if (m1.options[i].selected == true ) {
    m1.options[i] = null;
    function two2one() {
    m2len = m2.length ;
    for ( i=0; i<m2len ; i++){
    if (m2.options[i].selected == true ) {
    m1len = m1.length;
    m1.options[m1len]= new Option(m2.options[i].text);
    for ( i=(m2len-1); i>=0; i--) {
    if (m2.options[i].selected == true ) {
    m2.options[i] = null;
    //-->
    </script>
    <form method="POST" name="theForm" action="update.jsp">
    <table bgcolor="white" border="1" cellpadding="5" cellspacing="2" align="center">
    <tr><td align="center">
    <select id=menu1 size=10 multiple>
    <option>javascript</option>
    <option>php</option>
    <option>Zeo</option>
    <option>asp</option>
    <option>jsp</option>
    <option>ajax</option>
    <option>struts</option>
    </select>
    <p align="center"><input type="button" onClick="one2two()" value=" >> "></p>
    </td><td align="center">
    Languages you know:<BR>
    <SELECT NAME="language" multiple>
    <OPTION VALUE="c">C
    <OPTION VALUE="c++">C++
    </SELECT>
    <p align="center"><input type="button" onClick="two2one()" value=" << " ></p>
    </td></tr></table>
    <center><input type="submit" value="update"></center>
    </form>
    <h4><u>Back<h4>
    <script language= "JavaScript">
    var m1 = document.theForm.menu1;
    var m2 = document.theForm.language;
    </script>
    </body>
    </html>

  • I changed my primary email address because I could not access my old email and now my new iphone asks me to sign in to my old account in order to backup my apps and music from my icloud

    I changed my primary email address because I could not access my old email and now my new iphone asks me to sign in to my old account in order to backup my apps and music from my icloud. when I try to sign in using my password it says it is the wrong password.

    If you are only updating apps, that's normal  Apps and other purchased media are permanently tied to the ID used to purchase them.  You also don't back up apps or music to iCloud, the only thing backed up to iCloud is your app data, which is part of your iCloud backup by default.
    Is your phone signed into the old ID in Settings>iCloud?

  • One of my email accounts will not send email, and is not linked to data file.

    I have three email accounts set up with my Outlook 2010. All are POP3. All three accounts have been working fine, until the last day or so. One of my accounts will no longer allow me to send messages. When I go to my account settings, the two accounts that
    are working show the following:
    Selected account delivers new messages to the following locations:
    Email Address\Inbox
    in data file C:\...
    The one that doesn't work shows the following:
    Selected account delivers new messages to the following locations:
    My Name\Inbox
    The .ost data file for this email address is still in the same place, right next to the other two data files for the working accounts. For some reason, Outlook no longer has it linked to my account. How can I go about fixing this issue?
    Thanks.

    Hi Gwidion,
    Outlook 2010 and 2013 create PST per POP3 account. In simple, single PST file for single POP3 account. So, don’t be panic. Just change the location of the
    PST data file by following the given path in Outlook 2010:
    File >> Account Settings >>  Emails
    In the “Email” tab, choose the particular account which is not able to send emails and make a double click on it or click on
    “Change Folder” option. Finally, set the location of Email address.
    Hopefully it will help, otherwise simply recreate a new Outlook profile.
    For more:
    http://support.microsoft.com/kb/829918/en-us
    Thanks
    Clark Kent

  • HT204074 I want to delete my old email and use my new email and trying to update but old email keep coming back

    I m having trouble with a person not speaking well English .  I had fraud on my bank acct and my phone has all info. And I deleted old email and create all new gmail address. Now on my ipad I create new email address. And how will I delete my old email and use my new email, I can't even update cuz my old email still there.  Please help me.

    Go into the Settings> and then tap on Mail contacts and calendars.
    One that screen tap on the email account you want to delete. On the next screen at the bottom it should give you the options to "Delete Account" in red. Tap on that and delete the account from your iPad.

  • When I receive appointments by email and accept them they go into the enourage "on my mac" ical calendar which is not synced with mobileme.  How do I change where appointments are put ?

    When I receive appointments by email and accept them they go into the enourage "on my mac" ical calendar which is not synced with mobileme.  How do I change where appointments are put ?
    Or how can I choose where the appointment is put ?
    I use the mobileme sync services so the ical calendars that are synced are those in the "[email protected]" group.
    Please help !
    Nick

    Actually you can't drag the appointment to ano calendar - its says "You can’t make changes to this invitation., Only the organiser can change this event"
    Also if you double click on the received appointment and open the window the only calendars shown that you can select are the 'on my mac" ones, and not the sync'd ones.
    Any ideas welcome !!
    Nick

  • Sending email and alert notifcation using function module

    Hi All,
    I am trying to send email and alert notification messages using function modules in CRM. I am unable to send mail using 'SO_DOCUMENT_SEND_API1'. Getting a short dump message "dictionary mismatch". If anyone knows any FM which can be used for sending mails, please let me know. I also want to send alert messages using some FM. Please let me know any FM in this case as well.
    All help appreciated. This is urgent and please get back to me soon.
    Thanks
    Deno

    Hi Ranjit,
    Thanks a lot for the reply. I already tried these FMs and getting the error message
    Trigger Location of Runtime Error
        Program                                 SAPLBUPA_INTERFACE_TDTRANS
        Include                                 LBUPA_INTERFACE_TDTRANSTOP
        Row                                     4
    I dont know the reason behind the error. The SO_document_send FM is used inside all these FMs. So It wont work.
    Thanks
    Deno

  • I keep trying to send emails and it says its rejected by the server because it doesn't allow relaying... Any ideas how to fix?

    I keep trying to send emails and it says its rejected by the server because it doesn't allow relaying... Any ideas how to fix?

    There is something else that can cause this issue. Check the outgoing mail server setting. Make sure that your username and password are in there.
    Settings>Mail, Contacts, Calendars>Your email account>Account>Outgoing mail server - tap the server name next to SMTP and check in the primary server and make sure your username and password are entered and correct - even if it says that the password is optional.

  • Problem sending emails and attachments on ios 6

    ever since i updated my iPad 2 to i.os 6, i can't seem to send emails and attachments. Also, the mail box doesn't get updated. I tried restoring it back again and readding my gmail account but no avail...please help ASAP!!

    thanks for your quick reply alan
    yea i have tried a reset...the mails don't seem to be sending..and in the outbox i get the error "sending message content to the server failed" or "an error occured while delivering this message" or "the connection to the outgoing server p-08-smtp.mail.me.com failed"...

  • My ipod won't let me send emails and says it is rejected by the server? Any ideas how to fix this? thanks

    My ipod touch won't allow me to send emails and a box appears saying the message was rejected by the server? Any ideas how I can resolve this please?
    Thanks

    Try deletng the account from the iPod and re-entering the settings.
    Also see:
    iOS: Unable to send or receive email
    Did it work before?
    Does it send OK from another device?

Maybe you are looking for